├── .gitattributes
├── .gitignore
├── Injektor
├── App.config
├── Injector.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── LICENSE
├── NOTES.md
├── README.md
├── TS3Hook.sln
└── TS3Hook
├── PatchTools.cpp
├── PatchTools.h
├── TS3Hook.vcxproj
├── TS3Hook.vcxproj.filters
├── Ts3Plugin.cpp
├── asmhook.asm
├── dllmain.cpp
├── include
├── plugin_definitions.h
├── teamlog
│ └── logtypes.h
├── teamspeak
│ ├── clientlib_publicdefinitions.h
│ ├── public_definitions.h
│ ├── public_errors.h
│ ├── public_errors_rare.h
│ └── public_rare_definitions.h
└── ts3_functions.h
├── main.h
├── util.cpp
└── util.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/Injektor/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Injektor/Injector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}
8 | Exe
9 | Injector
10 | Injector
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | true
17 | ..\x64\Debug\
18 | TRACE;DEBUG;WIN64
19 | full
20 | x64
21 | prompt
22 | MinimumRecommendedRules.ruleset
23 | true
24 |
25 |
26 | ..\x64\Release\
27 | TRACE;WIN64
28 | true
29 | pdbonly
30 | x64
31 | prompt
32 | MinimumRecommendedRules.ruleset
33 | true
34 |
35 |
36 | true
37 | ..\x86\Debug\
38 | TRACE;DEBUG;WIN32
39 | full
40 | x86
41 | prompt
42 | MinimumRecommendedRules.ruleset
43 | true
44 |
45 |
46 | ..\x86\Release\
47 | TRACE;WIN32
48 | true
49 | pdbonly
50 | x86
51 | prompt
52 | MinimumRecommendedRules.ruleset
53 | true
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Injektor/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 |
8 | namespace Injector
9 | {
10 | static class Program
11 | {
12 | #if WIN32
13 | const string ProcName = "ts3client_win32";
14 | #else
15 | const string ProcName = "ts3client_win64";
16 | #endif
17 |
18 | static void Main(string[] args)
19 | {
20 | bool autoclose = args.Contains("--autoclose");
21 |
22 | var ok = DoHax();
23 | if (!autoclose || !ok)
24 | Console.ReadKey();
25 | }
26 |
27 | static bool DoHax()
28 | {
29 | Process[] procs;
30 | do
31 | {
32 | procs = Process.GetProcessesByName(ProcName);
33 | if (procs.Length == 0)
34 | {
35 | Console.WriteLine("No Process found");
36 | System.Threading.Thread.Sleep(1000);
37 | }
38 | } while (procs.Length == 0);
39 |
40 | Process proc;
41 | if (procs.Length == 1)
42 | {
43 | proc = procs[0];
44 | }
45 | else
46 | {
47 | for (int i = 0; i < procs.Length; i++)
48 | {
49 | Console.WriteLine("[{0}] TeamSpeak 3 ({1})", i, procs[i].MainModule.FileVersionInfo.FileVersion);
50 | }
51 |
52 | Console.WriteLine("Select proc [0-{0}]", procs.Length - 1);
53 | int index = int.Parse(Console.ReadLine());
54 | proc = procs[index];
55 | }
56 |
57 | string res = DllInjector.Inject(proc, @"TS3Hook.dll");
58 | Console.WriteLine("Status = {0}", res ?? "OK");
59 | Console.WriteLine("Done");
60 | return res == null;
61 | }
62 | }
63 |
64 | public static class DllInjector
65 | {
66 | [DllImport("kernel32.dll")]
67 | static extern int GetLastError();
68 |
69 | [DllImport("kernel32.dll", SetLastError = true)]
70 | static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, uint dwProcessId);
71 |
72 | [DllImport("kernel32.dll", SetLastError = true)]
73 | static extern int CloseHandle(IntPtr hObject);
74 |
75 | [DllImport("kernel32.dll", SetLastError = true)]
76 | static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName);
77 |
78 | [DllImport("kernel32.dll", SetLastError = true)]
79 | static extern IntPtr GetModuleHandle(string lpModuleName);
80 |
81 | [DllImport("kernel32.dll", SetLastError = true)]
82 | static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, IntPtr dwSize, uint flAllocationType, uint flProtect);
83 |
84 | [DllImport("kernel32.dll", SetLastError = true)]
85 | static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] buffer, uint size, int lpNumberOfBytesWritten);
86 |
87 | [DllImport("kernel32.dll", SetLastError = true)]
88 | static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttribute, IntPtr dwStackSize, IntPtr lpStartAddress,
89 | IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId);
90 |
91 | [DllImport("kernel32.dll", SetLastError = true)]
92 | static extern IntPtr LoadLibrary([In] string lpFileName);
93 |
94 | public static string Inject(Process proc, string sDllPath)
95 | {
96 | sDllPath = Path.GetFullPath(sDllPath);
97 | if (!File.Exists(sDllPath))
98 | return "Hook file not found";
99 |
100 | IntPtr hndProc = OpenProcess((0x2 | 0x8 | 0x10 | 0x20 | 0x400), 1, (uint)proc.Id);
101 |
102 | if (hndProc == IntPtr.Zero)
103 | {
104 | int errglc = GetLastError();
105 | return $"hndProc is null ({errglc:X})";
106 | }
107 |
108 | IntPtr lpLlAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
109 | if (lpLlAddress == IntPtr.Zero)
110 | {
111 | return "lpLLAddress is null";
112 | }
113 |
114 | IntPtr lpAddress = VirtualAllocEx(hndProc, (IntPtr)null, (IntPtr)sDllPath.Length, (0x1000 | 0x2000), 0X40);
115 | if (lpAddress == IntPtr.Zero)
116 | {
117 | return "lpAddress is null";
118 | }
119 |
120 | byte[] bytes = Encoding.ASCII.GetBytes(sDllPath);
121 | if (!WriteProcessMemory(hndProc, lpAddress, bytes, (uint)bytes.Length, 0))
122 | {
123 | int errglc = GetLastError();
124 | return $"WriteProcessMemory failed error: {errglc:X}";
125 | }
126 |
127 | var ptr = CreateRemoteThread(hndProc, IntPtr.Zero, IntPtr.Zero, lpLlAddress, lpAddress, 0, IntPtr.Zero);
128 | if (ptr == IntPtr.Zero)
129 | {
130 | int errglc = GetLastError();
131 | return $"CreateRemoteThread returned error ({errglc:X})";
132 | }
133 |
134 | for (int i = 0; i < 10; i++)
135 | {
136 | proc.Refresh();
137 | foreach (ProcessModule item in proc.Modules)
138 | {
139 | if (item.ModuleName == "TS3Hook.dll")
140 | {
141 | var hookptr = LoadLibrary(sDllPath);
142 | IntPtr plugEntry = GetProcAddress(hookptr, "ts3plugin_init");
143 | long diff = plugEntry.ToInt64() - hookptr.ToInt64();
144 | IntPtr finptr = (IntPtr)(item.BaseAddress.ToInt64() + diff);
145 |
146 | if (CreateRemoteThread(hndProc, IntPtr.Zero, IntPtr.Zero, finptr, IntPtr.Zero, 0, IntPtr.Zero) == IntPtr.Zero)
147 | {
148 | return "Starting target routine failed";
149 | }
150 |
151 | return null;
152 | }
153 | }
154 | Console.WriteLine("Searching for library...");
155 | System.Threading.Thread.Sleep(500);
156 | }
157 |
158 | CloseHandle(hndProc);
159 |
160 | return "Could not find library!";
161 | }
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/Injektor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("TS3Hook")]
5 | [assembly: AssemblyDescription("Teamspeak 3 Client Hook")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("ReSpeak")]
8 | [assembly: AssemblyProduct("TS3Hook")]
9 | [assembly: AssemblyCopyright("Copyright © Splamy 2017")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: Guid("3c292c14-45b3-4aef-b332-60fb8c022d8f")]
14 | [assembly: AssemblyVersion("1.0.0.0")]
15 | [assembly: AssemblyFileVersion("1.0.0.0")]
16 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Splamy
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NOTES.md:
--------------------------------------------------------------------------------
1 | C++ version changes:
2 | - 3.0.17 to version 120
3 | - 3.1 to Visual Studio 2015
4 | - 3.1.5 to 14.0.24215 (MSVC 2015-3)
5 |
6 | -console -nosingleinstance
7 |
8 | Pattern: PacketHandler::decrypt
9 | Ver: 3.1.6>?
10 | 33 C5 89 45 F0 53 56 57 50 8D 45 F4 64 A3 00 00 00 00 8B D9 83 3B 00
11 |
12 | Pattern: PacketHandler::inPacket+[Dispatch]
13 | Ver: 3.1.6>3.1.4.2>?
14 | 8B 4F 3C 6A 00 FF 77 44 FF 77 40 8B 01 57 56 FF 50 10
15 |
16 | 49 8B 4E 50 48 8B 01 C6 44 24 20 00 4D 8B 4E 58 4D 8B C6 48 8B D3 FF 50 20 EB
17 | xxxxxxxxxxxxxxxxxxxxxxxxxx
18 |
19 | TODO:
20 | setwhisperlist
21 |
22 | Latest Downloads
23 |
24 | []() []() []()
25 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Teamspeak 3 Hook [](../../releases/latest) []()
2 |
3 | ## What is this?
4 |
5 | This is a TS3Client Plugin that decrypts Teamspeak 3 command packets on the fly and displays them in Teamspeak's own Console.
6 |
7 | ## Features
8 |
9 | - Shows incoming/outgoing command packets of your client.
10 | - Ability to hide certain commands to keep focusing on the important stuff.
11 | - Ability to block certain outgoing commands to [hide your connectioninfo](https://github.com/ReSpeak/TS3Hook/issues/14) for example.
12 | - Ability to send own commands through your client.
13 |
14 | ## How to use
15 |
16 | 1. Download and install the [latest release](https://github.com/ReSpeak/TS3Hook/releases/latest) for your client.
17 | 2. Add `-console` to the startup parameters of your TS3Client shortcut. ([Screenshot](https://i.imgur.com/a5HgomX.png))
18 | 3. Start your Teamspeak 3 Client with the modified shortcut.
19 | 4. Take a look at the console named `Teamspeak 3 Client`.
20 | 5. OPTIONAL: Edit the `HookConf.ini` in the root directory of your TS3 binary to your needs.
21 | 6. Profit
22 |
23 | NOTE: You can also inject the DLL with the injector of the latest release.
24 |
25 | ## Injection
26 |
27 | Send a chat message with `~cmd` and append a command where ` ` (spaces) are replaced with `~s`.
28 | Example:
29 | `~cmdsendtextmessage~stargetmode=2~smsg=hi`
30 | to send
31 | `sendtextmessage targetmode=2 msg=hi`
32 |
33 |
34 |
35 | Screenshots
36 |
37 | 
38 | 
39 | 
40 |
41 |
--------------------------------------------------------------------------------
/TS3Hook.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2010
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TS3Hook", "TS3Hook\TS3Hook.vcxproj", "{568E865A-1CFF-457E-823F-0239A23ED904}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Injector", "Injektor\Injector.csproj", "{3C292C14-45B3-4AEF-B332-60FB8C022D8F}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Debug|x86 = Debug|x86
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {568E865A-1CFF-457E-823F-0239A23ED904}.Debug|x64.ActiveCfg = Debug|x64
19 | {568E865A-1CFF-457E-823F-0239A23ED904}.Debug|x64.Build.0 = Debug|x64
20 | {568E865A-1CFF-457E-823F-0239A23ED904}.Debug|x86.ActiveCfg = Debug|Win32
21 | {568E865A-1CFF-457E-823F-0239A23ED904}.Debug|x86.Build.0 = Debug|Win32
22 | {568E865A-1CFF-457E-823F-0239A23ED904}.Release|x64.ActiveCfg = Release|x64
23 | {568E865A-1CFF-457E-823F-0239A23ED904}.Release|x64.Build.0 = Release|x64
24 | {568E865A-1CFF-457E-823F-0239A23ED904}.Release|x86.ActiveCfg = Release|Win32
25 | {568E865A-1CFF-457E-823F-0239A23ED904}.Release|x86.Build.0 = Release|Win32
26 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Debug|x64.ActiveCfg = Debug|x64
27 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Debug|x64.Build.0 = Debug|x64
28 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Debug|x86.ActiveCfg = Debug|x86
29 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Debug|x86.Build.0 = Debug|x86
30 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Release|x64.ActiveCfg = Release|x64
31 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Release|x64.Build.0 = Release|x64
32 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Release|x86.ActiveCfg = Release|x86
33 | {3C292C14-45B3-4AEF-B332-60FB8C022D8F}.Release|x86.Build.0 = Release|x86
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | GlobalSection(ExtensibilityGlobals) = postSolution
39 | SolutionGuid = {11F2A761-C310-4A72-B76A-7662D416E6C1}
40 | EndGlobalSection
41 | EndGlobal
42 |
--------------------------------------------------------------------------------
/TS3Hook/PatchTools.cpp:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 | #include
3 | #include
4 | #include
5 |
6 | MODULEINFO GetModuleInfo(const LPCWSTR szModule)
7 | {
8 | MODULEINFO modinfo = { nullptr, 0, nullptr };
9 | const HMODULE hModule = GetModuleHandle(szModule);
10 | if (hModule == nullptr)
11 | return modinfo;
12 | GetModuleInformation(GetCurrentProcess(), hModule, &modinfo, sizeof(MODULEINFO));
13 | return modinfo;
14 | }
15 |
16 | SIZE_T FindPattern(const LPCWSTR module, const char* pattern, const char* mask)
17 | {
18 | //Get all module related information
19 | const MODULEINFO mInfo = GetModuleInfo(module);
20 |
21 | //Assign our base and module size
22 | //Having the values right is ESSENTIAL, this makes sure
23 | //that we don't scan unwanted memory and leading our game to crash
24 | const SIZE_T base = reinterpret_cast(mInfo.lpBaseOfDll);
25 | const SIZE_T size = static_cast(mInfo.SizeOfImage);
26 |
27 | //Get length for our mask, this will allow us to loop through our array
28 | const SIZE_T patternLength = strlen(mask);
29 |
30 | for (SIZE_T i = 0; i < size - patternLength; i++)
31 | {
32 | bool found = true;
33 | for (SIZE_T j = 0; j < patternLength && found; j++)
34 | {
35 | //if we have a ? in our mask then we have true by default,
36 | //or if the bytes match then we keep searching until finding it or not
37 | found &= mask[j] == '?' || pattern[j] == *reinterpret_cast(base + i + j);
38 | }
39 |
40 | //found = true, our entire pattern was found
41 | //return the memory addy so we can write to it
42 | if (found)
43 | {
44 | return base + i;
45 | }
46 | }
47 |
48 | return NULL;
49 | }
50 |
51 | void PatchBytes(const PBYTE pAddress, const BYTE overwrite[], const SIZE_T dwLen)
52 | {
53 | DWORD dwOldProtect, dwBkup;
54 | VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
55 | for (SIZE_T x = 0x0; x < dwLen; x++)
56 | pAddress[x] = overwrite[x];
57 | VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
58 | }
59 |
60 | #ifdef ENV32
61 | void MakeJMP(const PBYTE pAddress, const PVOID dwJumpTo, const SIZE_T dwLen)
62 | {
63 | DWORD dwOldProtect, dwBkup;
64 |
65 | // give the paged memory read/write permissions
66 |
67 | VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
68 |
69 | // calculate the distance between our address and our target location
70 | // and subtract the 5bytes, which is the size of the jmp
71 | // (0xE9 0xAA 0xBB 0xCC 0xDD) = 5 bytes
72 |
73 | const DWORD dwRelAddr = static_cast(reinterpret_cast(dwJumpTo) - reinterpret_cast(pAddress)) - 5;
74 |
75 | // overwrite the byte at pAddress with the jmp opcode (0xE9)
76 |
77 | *pAddress = 0xE9;
78 |
79 | // overwrite the next 4 bytes (which is the size of a DWORD)
80 | // with the dwRelAddr
81 |
82 | *reinterpret_cast(pAddress + 0x1) = dwRelAddr;
83 |
84 | // overwrite the remaining bytes with the NOP opcode (0x90)
85 | // NOP opcode = No OPeration
86 |
87 | for (SIZE_T x = 0x5; x < dwLen; x++)* (pAddress + x) = 0x90;
88 |
89 | // restore the paged memory permissions saved in dwOldProtect
90 |
91 | VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
92 | }
93 | #else
94 | void MakeJMP(PBYTE const pAddress, const PVOID dwJumpTo, const SIZE_T dwLen)
95 | {
96 | const DWORD MinLen = 14;
97 |
98 | if (dwLen < 14)
99 | return;
100 |
101 | BYTE stub[] =
102 | {
103 | 0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [$+6]
104 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ptr
105 | };
106 |
107 | DWORD dwOld = 0;
108 | VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOld);
109 |
110 | // orig
111 | memcpy(stub + 6, &dwJumpTo, 8);
112 | memcpy(pAddress, stub, sizeof(stub));
113 |
114 | for (int i = MinLen; i < dwLen; i++)
115 | * reinterpret_cast(reinterpret_cast(pAddress) + i) = 0x90;
116 |
117 | VirtualProtect(pAddress, dwLen, dwOld, &dwOld);
118 | }
119 | #endif
--------------------------------------------------------------------------------
/TS3Hook/PatchTools.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | SIZE_T FindPattern(const LPCWSTR module, const char *pattern, const char *mask);
6 | void MakeJMP(const PBYTE pAddress, const PVOID dwJumpTo, const SIZE_T dwLen);
7 | void PatchBytes(const PBYTE pAddress, const BYTE overwrite[], const SIZE_T dwLen);
--------------------------------------------------------------------------------
/TS3Hook/TS3Hook.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {568E865A-1CFF-457E-823F-0239A23ED904}
23 | Win32Proj
24 | TS3Hook
25 | 10.0
26 |
27 |
28 |
29 | DynamicLibrary
30 | true
31 | v142
32 | Unicode
33 |
34 |
35 | DynamicLibrary
36 | false
37 | v142
38 | true
39 | Unicode
40 |
41 |
42 | DynamicLibrary
43 | true
44 | v142
45 | Unicode
46 |
47 |
48 | DynamicLibrary
49 | false
50 | v142
51 | true
52 | Unicode
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | x86\$(Configuration)\
75 | $(SolutionDir)x86\$(Configuration)\
76 |
77 |
78 |
79 |
80 | $(SolutionDir)x86\$(Configuration)\
81 | x86\$(Configuration)\
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | Level3
90 | Disabled
91 | WIN32;_DEBUG;_WINDOWS;_USRDLL;TS3HOOK_EXPORTS;%(PreprocessorDefinitions)
92 |
93 |
94 | Windows
95 | true
96 |
97 |
98 |
99 |
100 |
101 |
102 | Level3
103 | Disabled
104 | _DEBUG;_WINDOWS;_USRDLL;TS3HOOK_EXPORTS;%(PreprocessorDefinitions)
105 |
106 |
107 |
108 | Windows
109 | true
110 |
111 |
112 |
113 |
114 | Level3
115 |
116 |
117 | MaxSpeed
118 | true
119 | true
120 | WIN32;NDEBUG;_WINDOWS;_USRDLL;TS3HOOK_EXPORTS;%(PreprocessorDefinitions)
121 |
122 |
123 | Windows
124 | true
125 | true
126 | true
127 |
128 |
129 |
130 |
131 | Level3
132 |
133 |
134 | MaxSpeed
135 | true
136 | true
137 | NDEBUG;_WINDOWS;_USRDLL;TS3HOOK_EXPORTS;%(PreprocessorDefinitions)
138 |
139 |
140 | Windows
141 | true
142 | true
143 | true
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 | false
155 |
156 |
157 | false
158 |
159 |
160 | false
161 |
162 |
163 | false
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 | true
174 | true
175 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/TS3Hook/TS3Hook.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 | Header Files
16 |
17 |
18 | Header Files
19 |
20 |
21 | Header Files
22 |
23 |
24 | Header Files
25 |
26 |
27 |
28 |
29 | Source Files
30 |
31 |
32 | Source Files
33 |
34 |
35 | Source Files
36 |
37 |
38 | Source Files
39 |
40 |
41 |
42 |
43 | Source Files
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TS3Hook/Ts3Plugin.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "main.h"
3 | #include "PatchTools.h"
4 |
5 | #define PLUGIN_API_VERSION 23
6 |
7 | const char* ts3plugin_name() { return "TS3Hook"; }
8 | const char* ts3plugin_version() { return "1.3.0"; }
9 |
10 | int ts3plugin_apiVersion() {
11 | int target = -1;
12 | SIZE_T match = NULL;
13 |
14 | #ifdef ENV64
15 | if (match == NULL && (match = FindPattern(MOD, "\x89\x83\x00\x04\x00\x00\x83\xC0?\x83\xF8\x01\x0F\x87", "xxxxxxxx?xxxxx")))
16 | target = abs((int)(*(signed char*)(match + 8)));
17 |
18 | if (match == NULL && (match = FindPattern(MOD, "\x89\x83??\x00\x00\x83\xF8?\x0F\x84", "xx??xxxx?xx")))
19 | target = abs((int)(*(signed char*)(match + 8)));
20 | #endif
21 |
22 | if (match == NULL)
23 | {
24 | printf("%s: Cannot auto-detect required PluginAPI version, using %d\n", ts3plugin_name(), PLUGIN_API_VERSION);
25 | return PLUGIN_API_VERSION;
26 | }
27 |
28 | printf("%s: Auto-detected required PluginAPI %d\n", ts3plugin_name(), target);
29 | return target;
30 | }
31 |
32 | const char* ts3plugin_author() { return "Splamy, Bluscream, alex720, exp111, Nicer"; }
33 | const char* ts3plugin_description() { return "Prints command packets on the console.\n\nhttps://github.com/ReSpeak/TS3Hook"; }
34 |
35 | int ts3plugin_init() {
36 | printf("-= %s v%s by %s =-\n", ts3plugin_name(), ts3plugin_version(), ts3plugin_author());
37 | return core_hook() ? 0 : 1;
38 | }
39 | void ts3plugin_shutdown() {
40 | printf("%s: Shutting down\n", ts3plugin_name());
41 | }
--------------------------------------------------------------------------------
/TS3Hook/asmhook.asm:
--------------------------------------------------------------------------------
1 | ; Initialized data
2 | .data
3 |
4 | .code
5 |
6 | EXTERN log_in_packet: PROC
7 | EXTERN log_out_packet: PROC
8 | EXTERN packet_in_hook_return: QWORD
9 | EXTERN packet_out_hook_return: QWORD
10 |
11 | PUBLIC packet_in_hook1
12 |
13 | pushaq macro
14 | PUSH rax
15 | PUSH rbx
16 | PUSH rcx
17 | PUSH rdx
18 | PUSH rbp
19 | PUSH rsi
20 | PUSH rdi
21 | PUSH r8
22 | PUSH r9
23 | PUSH r10
24 | PUSH r11
25 | PUSH r12
26 | PUSH r13
27 | PUSH r14
28 | PUSH r15
29 | endm
30 |
31 | popaq macro
32 | POP r15
33 | POP r14
34 | POP r13
35 | POP r12
36 | POP r11
37 | POP r10
38 | POP r9
39 | POP r8
40 | POP rdi
41 | POP rsi
42 | POP rbp
43 | POP rdx
44 | POP rcx
45 | POP rbx
46 | POP rax
47 | endm
48 |
49 | packet_in_hook1 proc
50 | ; Restore origial
51 | MOV rcx, [r14+80]
52 | MOV rax, [rcx]
53 | MOV BYTE PTR [rsp+32], 0
54 | MOV r9, [r14+88]
55 | MOV r8, r14
56 | MOV rdx, rbx
57 |
58 | pushaq
59 | SUB rsp, 32
60 |
61 | ; Log in-packet
62 | MOV rcx, QWORD PTR [rdx+8]
63 | ADD rcx, 11 ; str
64 | MOV edx, DWORD PTR [rdx+16]
65 | SUB edx, 11 ; len
66 | CALL log_in_packet
67 |
68 | ADD rsp, 32
69 | popaq
70 |
71 | JMP packet_in_hook_return
72 | packet_in_hook1 endp
73 |
74 | packet_in_hook2 proc
75 | ; Restore origial
76 | MOV rcx, [r15+80]
77 | MOV rax, [rcx]
78 | MOV BYTE PTR [rsp+32], 0
79 | MOV r9, [r15+88]
80 | MOV r8, r15
81 | MOV rdx, rbx
82 |
83 | pushaq
84 | SUB rsp, 32
85 |
86 | ; Log in-packet
87 | MOV rcx, QWORD PTR [rdx+8]
88 | ADD rcx, 11 ; str
89 | MOV edx, DWORD PTR [rdx+16]
90 | SUB edx, 11 ; len
91 | CALL log_in_packet
92 |
93 | ADD rsp, 32
94 | popaq
95 |
96 | JMP packet_in_hook_return
97 | packet_in_hook2 endp
98 |
99 | packet_out_hook1 proc
100 | pushaq
101 | SUB rsp, 32
102 |
103 | ; Log out-packet
104 | MOV rcx, QWORD PTR [rdi]
105 | ADD rcx, 13 ; str
106 | MOV edx, DWORD PTR [rdi+8]
107 | SUB edx, 13 ; len
108 | CALL log_out_packet
109 |
110 | ADD rsp, 32
111 | popaq
112 |
113 | ; Restore origial
114 | MOV [rbp+0], eax
115 | CMP eax, 1
116 | SETZ cl
117 | MOV [rsp+68], cl
118 | CMP BYTE PTR [rsp+64], 0
119 |
120 | JMP packet_out_hook_return
121 | packet_out_hook1 endp
122 |
123 | packet_out_hook2 proc
124 | pushaq
125 | SUB rsp, 32
126 |
127 | ; Log out-packet
128 | MOV rcx, QWORD PTR [rdi]
129 | ADD rcx, 13 ; str
130 | MOV edx, DWORD PTR [rdi+8]
131 | SUB edx, 13 ; len
132 | CALL log_out_packet
133 |
134 | ADD rsp, 32
135 | popaq
136 |
137 | ; Restore origial
138 | MOV [rbp-32], eax
139 | CMP eax, 1
140 | SETZ cl
141 | MOV [rsp+80], cl
142 | CMP BYTE PTR [rsp+64], 0
143 |
144 | JMP packet_out_hook_return
145 | packet_out_hook2 endp
146 |
147 | packet_out_hook3 proc
148 | ; Restore origial
149 | MOV rdx, [rax]
150 | MOV [rsp+80], rdx
151 | MOV [rsp+120], rdx
152 | MOV rbx, [rax+8]
153 |
154 | pushaq
155 |
156 | LEA eax, [rdi-2]
157 | CMP al, 1
158 | JA _skip_packet
159 | TEST r9b, r9b
160 | JNZ _skip_packet
161 |
162 | SUB rsp, 32
163 |
164 | ; Log out-packet
165 | MOV rcx, QWORD PTR [rsi]
166 | ADD rcx, 13 ; str
167 | MOV edx, DWORD PTR [rsi+8]
168 | SUB edx, 13 ; len
169 | CALL log_out_packet
170 |
171 | ADD rsp, 32
172 |
173 | _skip_packet:
174 | popaq
175 |
176 | JMP packet_out_hook_return
177 | packet_out_hook3 endp
178 |
179 | packet_out_hook4 proc
180 | pushaq
181 | SUB rsp, 32
182 |
183 | ; Log out-packet
184 | MOV rcx, QWORD PTR [rdi+8]
185 | ADD rcx, 13 ; str
186 | MOV edx, DWORD PTR [rdi+16]
187 | SUB edx, 13 ; len
188 | CALL log_out_packet
189 |
190 | ADD rsp, 32
191 | popaq
192 |
193 | ; Restore origial
194 | MOV [rbp+2528], eax
195 | CMP eax, r14d
196 | SETZ r12b
197 | CMP BYTE PTR [rsp+64], 0
198 |
199 | JMP packet_out_hook_return
200 | packet_out_hook4 endp
201 |
202 | END
--------------------------------------------------------------------------------
/TS3Hook/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "main.h"
3 | #include "util.h"
4 | #include
5 | #include "PatchTools.h"
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #ifdef ENV32
13 | #define STD_DECL __cdecl
14 |
15 | // Ver: 3.1.6>3.1.4.2>3.0.17 !3.0.16
16 | const char* PATT_IN_1 = "\x8B\x4F\x3C\x6A\x00\xFF\x77\x44\xFF\x77\x40\x8B\x01\x57\x56\xFF\x50\x10";
17 | const char* MASK_IN_1 = "xxxxxxxxxxxxxxxxxx";
18 |
19 | // Ver: 3.1.6>3.1.4.2>3.1>? !3.0.17
20 | const char* PATT_OUT_1 = "\xC6\x45\xFC\x06\x80\xF9\x02\x74\x09\x80\xF9\x03";
21 | const char* MASK_OUT_1 = "xxxxxxxxxxxx";
22 | #else
23 | #define STD_DECL
24 | hookpt IN_HOOKS[] = {
25 | hookpt{ 22, 22, packet_in_hook1, "\x49\x8B\x4E\x50\x48\x8B\x01\xC6\x44\x24\x20\x00\x4D\x8B\x4E\x58\x4D\x8B\xC6\x48\x8B\xD3\xFF\x50\x20\xEB", "xxxxxxxxxxxxxxxxxxxxxxxxxx" },
26 | hookpt{ 22, 22, packet_in_hook2, "\x49\x8B\x4F\x50\x48\x8B\x01\xC6\x44\x24\x20\x00\x4D\x8B\x4F\x58\x4D\x8B\xC7\x48\x8B\xD3\xFF\x50\x20\x41", "xxxxxxxxxxxxxxxxxxxxxxxxxx" },
27 | };
28 |
29 | hookpt OUT_HOOKS[] = {
30 | hookpt{ 18, 18, packet_out_hook1, "\x89\x45\x00\x83\xF8\x01\x0F\x94\xC1\x88\x4C\x24\x44\x80\x7C\x24\x40\x00", "xxxxxxxxxxxxxxxxxx" },
31 | hookpt{ 18, 18, packet_out_hook2, "\x89\x45\xE0\x83\xF8\x01\x0F\x94\xC1\x88\x4C\x24\x50\x80\x7C\x24\x40\x00", "xxxxxxxxxxxxxxxxxx" },
32 | hookpt{ 17, 17, packet_out_hook3, "\x48\x8B\x10\x48\x89\x54\x24\x50\x48\x89\x54\x24\x78\x48\x8B\x58\x08", "xxxxxxxxxxxxxxxxx" },
33 | hookpt{ 18, 18, packet_out_hook4, "\x89\x85\xE0\x09\x00\x00\x41\x3B\xC6\x41\x0F\x94\xC4\x80\x7C\x24\x40\x00", "xxxxxxxxxxxxxxxxxx" },
34 | };
35 | #endif
36 |
37 | #define sizeofa(a) (sizeof(a) / sizeof(a[0]))
38 |
39 | #define CRED (FOREGROUND_RED | FOREGROUND_INTENSITY)
40 | #define CGREEN (FOREGROUND_GREEN | FOREGROUND_INTENSITY)
41 | #define CBLUE (FOREGROUND_BLUE | FOREGROUND_INTENSITY)
42 | #define CYELLOW (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY)
43 | #define CCYAN (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY)
44 | #define CPINK (FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY)
45 |
46 | #define CWRITE(color, format, ...) {\
47 | if (hConsole != nullptr) SetConsoleTextAttribute(hConsole, color);\
48 | printf (format, __VA_ARGS__);\
49 | if (hConsole != nullptr) SetConsoleTextAttribute(hConsole, 15);\
50 | }
51 |
52 | HANDLE hConsole = nullptr;
53 |
54 | // RUNTIME CALCED
55 | extern "C"
56 | {
57 | SIZE_T packet_in_hook_return = 0x0;
58 | SIZE_T packet_out_hook_return = 0x0;
59 | }
60 | std::string nickname;
61 | bool nick_change_needed = false;
62 | LPCWSTR lpFileName = L".\\HookConf.ini";
63 | LPCWSTR lpSection = L"Config";
64 | const char* prefix = "TS3Hook: ";
65 | wchar_t outprefix[256];
66 | wchar_t outsuffix[256];
67 | wchar_t inprefix[256];
68 | wchar_t insuffix[256];
69 | wchar_t bypass_modalquit[3];
70 | wchar_t teaspeak_anti_error[3];
71 | std::vector ignorecmds;
72 | std::vector blockcmds;
73 | std::vector clientver;
74 | const std::string injectcmd(" msg=~cmd");
75 | const std::string outjectcmd(" msg=-cmd");
76 | const std::string clientinit("clientinit ");
77 | const std::string sendtextmessage("sendtextmessage ");
78 | const std::string notifytextmessage("notifytextmessage ");
79 | const std::string hostmsg_mode("virtualserver_hostmessage_mode=3");
80 | const std::string not_implemented("error id=2 msg=not\\simplemented");
81 | const std::string bell = std::string(1, '\a');
82 | const std::string null_str = std::string(1, '\0');
83 | static struct TS3Functions ts3_functions;
84 | anyID myID;
85 | uint64 cid;
86 |
87 | #define CONFSETT(var, form) if(GetLastError()) {\
88 | printf("%sFor "#var" using default: %"#form"\n", prefix, var);\
89 | } else {\
90 | printf("%sFor "#var" using: %"#form"\n", prefix, var);\
91 | }
92 |
93 | template
94 | void split(const std::string& s, const char delim, Out result) {
95 | std::stringstream ss(s);
96 | std::string item;
97 | while (std::getline(ss, item, delim)) {
98 | *(result++) = item;
99 | }
100 | }
101 |
102 | std::vector split(const std::string& s, const char delim) {
103 | std::vector elems;
104 | split(s, delim, std::back_inserter(elems));
105 | return elems;
106 | }
107 |
108 | bool file_exists(const LPCWSTR file_name)
109 | {
110 | std::ifstream file(file_name);
111 | return file.good();
112 | }
113 | void ts3plugin_setFunctionPointers(const struct TS3Functions funcs) {
114 | ts3_functions = funcs;
115 | }
116 |
117 | void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber) {
118 | if (newStatus == STATUS_CONNECTION_ESTABLISHED && nick_change_needed) {
119 | nick_change_needed = false;
120 | ts3_functions.getClientID(serverConnectionHandlerID, &myID);
121 | ts3_functions.getChannelOfClient(serverConnectionHandlerID, myID, &cid);
122 | std::string nick = "~cmdclientupdate~sclient_nickname=" + nickname;
123 | ts3_functions.requestSendChannelTextMsg(serverConnectionHandlerID, nick.c_str(), cid, NULL);
124 | }
125 | }
126 |
127 | int ts3plugin_onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, const char* extraMessage)
128 | {
129 | if (strcmp(returnCode, "th") == 0)
130 | return 1;
131 | return 0;
132 | }
133 |
134 | void create_config(const LPCWSTR file_name)
135 | {
136 | WritePrivateProfileString(lpSection, L"outprefix", L"[OUT]", file_name);
137 | WritePrivateProfileString(lpSection, L"outsuffix", L"", file_name);
138 | WritePrivateProfileString(lpSection, L"inprefix", L"[IN ]", file_name);
139 | WritePrivateProfileString(lpSection, L"insuffix", L"", file_name);
140 | WritePrivateProfileString(lpSection, L"ignorecmds", L"", file_name);
141 | WritePrivateProfileString(lpSection, L"blockcmds", L"connectioninfoautoupdate,setconnectioninfo,clientchatcomposing", file_name);
142 | WritePrivateProfileString(lpSection, L"clientversion", L"3.?.? [Build: 5680278000]|Windows|DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg==", file_name);
143 | WritePrivateProfileString(lpSection, L"bypass_modalquit", L"1", file_name);
144 | WritePrivateProfileString(lpSection, L"teaspeak_anti_error", L"1", file_name);
145 | WritePrivateProfileString(lpSection, L"useunicode", L"1", file_name);
146 | //printf("%sCreated config %ls\n", prefix, file_name);
147 | }
148 |
149 | void replace_all(std::string& str, const std::string& from, const std::string& to) {
150 | if (from.empty() || str.empty())
151 | return;
152 | size_t start_pos = 0;
153 | while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
154 | str.replace(start_pos, from.length(), to);
155 | start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
156 | }
157 | }
158 |
159 | template
160 | void read_split_list(wchar_t(&splitbuffer)[Size], std::vector& out, char split_char)
161 | {
162 | char outbuffer[Size];
163 | size_t converted;
164 | wcstombs_s(&converted, outbuffer, splitbuffer, Size);
165 | const std::string ignorestr(outbuffer, converted - 1);
166 | out = split(ignorestr, split_char);
167 | }
168 |
169 | void read_config()
170 | {
171 | if (!file_exists(lpFileName)) {
172 | CWRITE(CYELLOW, "Make sure to start your Teamspeak Client as admin atleast once to create \"HookConf.ini\"!\n");
173 | create_config(lpFileName);
174 | }
175 | GetPrivateProfileString(lpSection, L"outprefix", L"[OUT]", outprefix, sizeofa(outprefix), lpFileName);
176 | //CONFSETT(outprefix, ls);
177 | GetPrivateProfileString(lpSection, L"outsuffix", L"", outsuffix, sizeofa(outsuffix), lpFileName);
178 | //CONFSETT(outsuffix, ls);
179 | GetPrivateProfileString(lpSection, L"inprefix", L"[IN ]", inprefix, sizeofa(inprefix), lpFileName);
180 | //CONFSETT(inprefix, ls);
181 | GetPrivateProfileString(lpSection, L"insuffix", L"", insuffix, sizeofa(insuffix), lpFileName);
182 | //CONFSETT(insuffix, ls);
183 | wchar_t splitbuffer[4096];
184 | GetPrivateProfileString(lpSection, L"ignorecmds", L"", splitbuffer, sizeofa(splitbuffer), lpFileName);
185 | read_split_list(splitbuffer, ignorecmds, ',');
186 | CWRITE(CCYAN, "%sIgnoring ", prefix);
187 | for (const auto& cmd : ignorecmds)
188 | CWRITE(CCYAN, "%s,", cmd.c_str());
189 | printf("\n");
190 | GetPrivateProfileString(lpSection, L"blockcmds", L"", splitbuffer, sizeofa(splitbuffer), lpFileName);
191 | CWRITE(CYELLOW, "%sBlocking ", prefix);
192 | read_split_list(splitbuffer, blockcmds, ',');
193 | for (const auto& cmd : blockcmds)
194 | CWRITE(CYELLOW, "%s,", cmd.c_str());
195 | printf("\n");
196 | GetPrivateProfileString(lpSection, L"clientversion", L"", splitbuffer, sizeofa(splitbuffer), lpFileName);
197 | read_split_list(splitbuffer, clientver, '|');
198 | for (auto& versionpart : clientver)
199 | {
200 | replace_all(versionpart, " ", R"(\s)");
201 | replace_all(versionpart, "/", R"(\/)");
202 | }
203 | GetPrivateProfileString(lpSection, L"bypass_modalquit", L"1", bypass_modalquit, sizeofa(bypass_modalquit), lpFileName);
204 | GetPrivateProfileString(lpSection, L"teaspeak_anti_error", L"1", teaspeak_anti_error, sizeofa(teaspeak_anti_error), lpFileName);
205 | wchar_t useunicode[1];
206 | GetPrivateProfileString(lpSection, L"useunicode", L"1", useunicode, sizeofa(useunicode), lpFileName);
207 | if (wcscmp(useunicode, L"1") == 0) {
208 | SetConsoleOutputCP(65001);
209 | CWRITE(CCYAN, "Using UTF-8 encoding");
210 | printf("\n");
211 | }
212 | }
213 |
214 | bool core_hook()
215 | {
216 | hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
217 |
218 | read_config();
219 |
220 | if (!try_hook())
221 | {
222 | CWRITE(CRED, "%sPacket dispatcher not found, aborting\n", prefix);
223 | return false;
224 | }
225 |
226 | return true;
227 | }
228 |
229 | void STD_DECL log_in_packet(char* packet, int length)
230 | {
231 | auto buffer = std::string(packet, length);
232 | replace_all(buffer, bell, "");
233 | memcpy(packet, buffer.c_str(), buffer.length());
234 | memset(packet + buffer.length(), ' ', length - buffer.length());
235 | const auto find_pos_inits = buffer.find("initserver ");
236 | const auto find_pos_err = buffer.find(not_implemented);
237 | const auto find_pos_outject = buffer.find(outjectcmd);
238 | const auto find_pos_notcmd = buffer.find(notifytextmessage);
239 | bool modified = false;
240 |
241 | if (find_pos_outject != std::string::npos)
242 | {
243 | const auto in_off = find_pos_outject + outjectcmd.size();
244 | auto in_str = std::string(packet + in_off, length - in_off);
245 | replace_all(in_str, std::string("~s"), std::string(" "));
246 | replace_all(in_str, std::string("\\\\s"), std::string("\\s"));
247 | memcpy(packet, in_str.c_str(), in_str.length());
248 | memset(packet + in_str.length(), ' ', length - in_str.length());
249 | modified = true;
250 | }
251 | else if (find_pos_inits != std::string::npos) {
252 | const auto virtualserver_hostmessage_mode = buffer.find(hostmsg_mode);
253 | const auto virtualserver_hostmessage_set = buffer.find("virtualserver_hostmessage=");
254 | if (virtualserver_hostmessage_mode != std::string::npos && virtualserver_hostmessage_set != std::string::npos && wcscmp(L"1", bypass_modalquit) == 0) {
255 | auto in_str = buffer;
256 | replace_all(in_str, hostmsg_mode, "virtualserver_hostmessage_mode=2");
257 | memcpy(packet, in_str.c_str(), in_str.length());
258 | memset(packet + in_str.length(), ' ', length - in_str.length());
259 | ts3_functions.printMessageToCurrentTab("TS3Hook: The server you're connecting to has it's hostmessage mode set to [color=red]MODALQUIT[/color], but you can stay connected ;)");
260 | modified = true;
261 | }
262 | }
263 | else if (find_pos_err != std::string::npos && wcscmp(L"1", teaspeak_anti_error) == 0) {
264 | auto in_str = buffer;
265 | replace_all(in_str, not_implemented, "error id=0 msg return_code=th");
266 | memcpy(packet, in_str.c_str(), in_str.length());
267 | memset(packet + in_str.length(), ' ', length - in_str.length());
268 | modified = true;
269 | }
270 | for each (std::string filter in ignorecmds) {
271 | if (!buffer.compare(0, filter.size(), filter))
272 | return;
273 | }
274 | CWRITE(modified ? CPINK : CCYAN, "%ls %.*s %ls\n", inprefix, length, packet, insuffix);
275 | }
276 |
277 | void STD_DECL log_out_packet(char* packet, int length)
278 | {
279 | auto buffer = std::string(packet, length);
280 | replace_all(buffer, "\a", "_");
281 | replace_all(buffer, null_str, "_");
282 | memcpy(packet, buffer.c_str(), buffer.length());
283 | memset(packet + buffer.length(), ' ', length - buffer.length());
284 | const auto find_pos_inject = buffer.find(injectcmd);
285 | const auto find_pos_cinit = buffer.find(clientinit);
286 | const auto find_pos_sendcmd = buffer.find(sendtextmessage);
287 | bool injected = false;
288 |
289 | if (find_pos_inject != std::string::npos)
290 | {
291 | const auto in_off = find_pos_inject + injectcmd.size();
292 | auto in_str = std::string(packet + in_off, length - in_off);
293 |
294 | replace_all(in_str, std::string("~s"), std::string(" "));
295 |
296 | memcpy(packet, in_str.c_str(), in_str.length());
297 | memset(packet + in_str.length(), ' ', length - in_str.length());
298 |
299 | injected = true;
300 | }
301 | else if (find_pos_cinit != std::string::npos && find_pos_sendcmd == std::string::npos && !clientver.empty())
302 | {
303 | const auto client_ver = find_param(buffer, "client_version=");
304 | const auto client_platform = find_param(buffer, "client_platform=");
305 | const auto client_version_sign = find_param(buffer, "client_version_sign=");
306 | const auto client_nickname = find_param(buffer, "client_nickname=");
307 | auto in_str = buffer;
308 | if (!clientver[2].empty()) {
309 | in_str.erase(std::get<0>(client_version_sign), std::get<1>(client_version_sign));
310 | in_str.insert(std::get<0>(client_version_sign), clientver[2]);
311 | }
312 | if (!clientver[1].empty()) {
313 | in_str.erase(std::get<0>(client_platform), std::get<1>(client_platform));
314 | in_str.insert(std::get<0>(client_platform), clientver[1]);
315 | }
316 | if (!clientver[0].empty()) {
317 | in_str.erase(std::get<0>(client_ver), std::get<1>(client_ver));
318 | in_str.insert(std::get<0>(client_ver), clientver[0]);
319 | }
320 |
321 | const auto length_difference = (long)buffer.size() - (long)in_str.size();
322 | if (length_difference >= 0) {
323 | memcpy(packet, in_str.c_str(), in_str.length());
324 | memset(packet + in_str.length(), ' ', length - in_str.length());
325 | }
326 | else if (length_difference + (long)std::get<1>(client_nickname) - 3 >= 0) {
327 | nickname = in_str.substr(std::get<0>(client_nickname), std::get<1>(client_nickname));
328 | replace_all(nickname, R"(\s)", " ");
329 | nick_change_needed = true;
330 | in_str.erase(std::get<0>(client_nickname), std::get<1>(client_nickname));
331 | in_str.insert(std::get<0>(client_nickname), random_string(3));
332 | memcpy(packet, in_str.c_str(), in_str.length());
333 | memset(packet + in_str.length(), ' ', length - in_str.length());
334 | }
335 | else {
336 | printf("[INFO] Couldn't set fake platform. Choose a longer nickname.\n");
337 | }
338 |
339 | injected = true;
340 | }
341 | else
342 | {
343 | for each (std::string filter in ignorecmds) {
344 | if (!buffer.compare(0, filter.size(), filter))
345 | return;
346 | }
347 | for each (std::string filter in blockcmds) {
348 | if (!buffer.compare(0, filter.size(), filter)) {
349 | memset(packet, ' ', length);
350 | CWRITE(CYELLOW, "%ls Blocking %s %ls\n", outprefix, filter.c_str(), outsuffix);
351 | return;
352 | }
353 | }
354 | }
355 |
356 | CWRITE(injected ? CPINK : CGREEN, "%ls %.*s %ls\n", outprefix, length, packet, outsuffix);
357 | }
358 |
359 | #ifdef ENV32
360 | bool try_hook()
361 | {
362 | const auto match_in_1 = FindPattern(MOD, PATT_IN_1, MASK_IN_1);
363 | const auto match_out_1 = FindPattern(MOD, PATT_OUT_1, MASK_OUT_1);
364 |
365 | if (match_in_1 != NULL && match_out_1 != NULL)
366 | {
367 | const SIZE_T OFFS_IN_1 = 13;
368 | packet_in_hook_return = match_in_1 + OFFS_IN_1 + 5;
369 | MakeJMP(reinterpret_cast(match_in_1 + OFFS_IN_1), reinterpret_cast(packet_in_hook1), 5);
370 |
371 | const SIZE_T OFFS_OUT_1 = 33;
372 | packet_out_hook_return = match_out_1 + OFFS_OUT_1 + 8;
373 | MakeJMP(reinterpret_cast(match_out_1 + OFFS_OUT_1), reinterpret_cast(packet_out_hook1), 8);
374 |
375 | CWRITE(CGREEN, "%sHook successfull! (x86 PKGIN: %zX PKGOUT: %zX\n", prefix, match_in_1, match_out_1);
376 | return true;
377 | }
378 |
379 | return false;
380 | }
381 |
382 | void __declspec(naked) packet_in_hook1()
383 | {
384 | __asm
385 | {
386 | // +11
387 |
388 | PUSHAD
389 | MOV ecx, [esi + 8]
390 | SUB ecx, 11
391 | PUSH ecx // len
392 | MOV eax, [esi + 4]
393 | ADD eax, 11
394 | PUSH eax // str
395 | CALL log_in_packet
396 | ADD esp, 8
397 | POPAD
398 |
399 | // overwritten
400 | PUSH edi
401 | PUSH esi
402 | CALL DWORD PTR[eax + 16]
403 | JMP packet_in_hook_return
404 | }
405 | }
406 |
407 | void __declspec(naked) packet_out_hook1()
408 | {
409 | __asm
410 | {
411 | // +13
412 |
413 | PUSHAD
414 | MOV ecx, [edi + 4]
415 | SUB ecx, 13
416 | PUSH ecx // len
417 | MOV eax, [edi]
418 | ADD eax, 13
419 | PUSH eax // str
420 | CALL log_out_packet
421 | ADD esp, 8
422 | POPAD
423 |
424 | // overwritten
425 | CMP DWORD PTR[ebp + 16], 1
426 | SETZ BYTE PTR[ebp + 4]
427 | JMP packet_out_hook_return
428 | }
429 | }
430 | #else
431 | bool try_hook()
432 | {
433 | SIZE_T match_in = NULL;
434 | hookpt* pt_in = nullptr;
435 | for (hookpt& pt : IN_HOOKS)
436 | {
437 | match_in = FindPattern(MOD, pt.PATT, pt.MASK);
438 | if (match_in != NULL)
439 | {
440 | pt_in = &pt;
441 | break;
442 | }
443 | }
444 |
445 | SIZE_T match_out = NULL;
446 | hookpt* pt_out = nullptr;
447 | for (hookpt& pt : OUT_HOOKS)
448 | {
449 | match_out = FindPattern(MOD, pt.PATT, pt.MASK);
450 | if (match_out != NULL)
451 | {
452 | pt_out = &pt;
453 | break;
454 | }
455 | }
456 |
457 | if (match_in != NULL && match_out != NULL)
458 | {
459 | packet_in_hook_return = match_in + pt_in->hook_return_offset;
460 | MakeJMP(reinterpret_cast(match_in), pt_in->target_hook, pt_in->hook_length);
461 |
462 | packet_out_hook_return = match_out + pt_out->hook_return_offset;
463 | MakeJMP(reinterpret_cast(match_out), pt_out->target_hook, pt_out->hook_length);
464 | CWRITE(CGREEN, "%sHook successfull! (x64 PKGIN: %zX PKGOUT: %zX)\n", prefix, match_in, match_out);
465 | return true;
466 | }
467 |
468 | return false;
469 | }
470 | #endif
471 |
472 | void idle_loop()
473 | {
474 | while (true)
475 | {
476 | Sleep(100);
477 | }
478 | }
479 |
--------------------------------------------------------------------------------
/TS3Hook/include/plugin_definitions.h:
--------------------------------------------------------------------------------
1 | #ifndef PLUGIN_DEFINITIONS
2 | #define PLUGIN_DEFINITIONS
3 |
4 | /* Return values for ts3plugin_offersConfigure */
5 | enum PluginConfigureOffer {
6 | PLUGIN_OFFERS_NO_CONFIGURE = 0, /* Plugin does not implement ts3plugin_configure */
7 | PLUGIN_OFFERS_CONFIGURE_NEW_THREAD, /* Plugin does implement ts3plugin_configure and requests to run this function in an own thread */
8 | PLUGIN_OFFERS_CONFIGURE_QT_THREAD /* Plugin does implement ts3plugin_configure and requests to run this function in the Qt GUI thread */
9 | };
10 |
11 | enum PluginMessageTarget {
12 | PLUGIN_MESSAGE_TARGET_SERVER = 0,
13 | PLUGIN_MESSAGE_TARGET_CHANNEL
14 | };
15 |
16 | enum PluginItemType {
17 | PLUGIN_SERVER = 0,
18 | PLUGIN_CHANNEL,
19 | PLUGIN_CLIENT
20 | };
21 |
22 | enum PluginMenuType {
23 | PLUGIN_MENU_TYPE_GLOBAL = 0,
24 | PLUGIN_MENU_TYPE_CHANNEL,
25 | PLUGIN_MENU_TYPE_CLIENT
26 | };
27 |
28 | #define PLUGIN_MENU_BUFSZ 128
29 |
30 | struct PluginMenuItem {
31 | enum PluginMenuType type;
32 | int id;
33 | char text[PLUGIN_MENU_BUFSZ];
34 | char icon[PLUGIN_MENU_BUFSZ];
35 | };
36 |
37 | #define PLUGIN_HOTKEY_BUFSZ 128
38 |
39 | struct PluginHotkey {
40 | char keyword[PLUGIN_HOTKEY_BUFSZ];
41 | char description[PLUGIN_HOTKEY_BUFSZ];
42 | };
43 |
44 | struct PluginBookmarkList;
45 | struct PluginBookmarkItem {
46 | char* name;
47 | unsigned char isFolder;
48 | unsigned char reserved[3];
49 | union{
50 | char* uuid;
51 | struct PluginBookmarkList* folder;
52 | };
53 | };
54 |
55 | struct PluginBookmarkList{
56 | int itemcount;
57 | struct PluginBookmarkItem items[1]; //should be 0 but compiler complains
58 | };
59 |
60 | enum PluginGuiProfile{
61 | PLUGIN_GUI_SOUND_CAPTURE = 0,
62 | PLUGIN_GUI_SOUND_PLAYBACK,
63 | PLUGIN_GUI_HOTKEY,
64 | PLUGIN_GUI_SOUNDPACK,
65 | PLUGIN_GUI_IDENTITY
66 | };
67 |
68 | enum PluginConnectTab{
69 | PLUGIN_CONNECT_TAB_NEW = 0,
70 | PLUGIN_CONNECT_TAB_CURRENT,
71 | PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED
72 | };
73 |
74 | #endif
75 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamlog/logtypes.h:
--------------------------------------------------------------------------------
1 | #ifndef TEAMLOG_LOGTYPES_H
2 | #define TEAMLOG_LOGTYPES_H
3 |
4 | enum LogTypes {
5 | LogType_NONE = 0x0000,
6 | LogType_FILE = 0x0001,
7 | LogType_CONSOLE = 0x0002,
8 | LogType_USERLOGGING = 0x0004,
9 | LogType_NO_NETLOGGING = 0x0008,
10 | LogType_DATABASE = 0x0010,
11 | LogType_SYSLOG = 0x0020,
12 | };
13 |
14 | enum LogLevel {
15 | LogLevel_CRITICAL = 0, //these messages stop the program
16 | LogLevel_ERROR, //everything that is really bad, but not so bad we need to shut down
17 | LogLevel_WARNING, //everything that *might* be bad
18 | LogLevel_DEBUG, //output that might help find a problem
19 | LogLevel_INFO, //informational output, like "starting database version x.y.z"
20 | LogLevel_DEVEL //developer only output (will not be displayed in release mode)
21 | };
22 |
23 | #endif //TEAMLOG_LOGTYPES_H
24 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamspeak/clientlib_publicdefinitions.h:
--------------------------------------------------------------------------------
1 | #ifndef CLIENTLIB_PUBLICDEFINITIONS_H
2 | #define CLIENTLIB_PUBLICDEFINITIONS_H
3 |
4 | enum Visibility {
5 | ENTER_VISIBILITY = 0,
6 | RETAIN_VISIBILITY,
7 | LEAVE_VISIBILITY
8 | };
9 |
10 | enum ConnectStatus {
11 | STATUS_DISCONNECTED = 0, //There is no activity to the server, this is the default value
12 | STATUS_CONNECTING, //We are trying to connect, we haven't got a clientID yet, we haven't been accepted by the server
13 | STATUS_CONNECTED, //The server has accepted us, we can talk and hear and we got a clientID, but we don't have the channels and clients yet, we can get server infos (welcome msg etc.)
14 | STATUS_CONNECTION_ESTABLISHING,//we are CONNECTED and we are visible
15 | STATUS_CONNECTION_ESTABLISHED, //we are CONNECTED and we have the client and channels available
16 | };
17 |
18 | enum LocalTestMode {
19 | TEST_MODE_OFF = 0,
20 | TEST_MODE_VOICE_LOCAL_ONLY = 1,
21 | TEST_MODE_VOICE_LOCAL_AND_REMOTE = 2,
22 | };
23 |
24 | #endif //CLIENTLIB_PUBLICDEFINITIONS_H
25 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamspeak/public_definitions.h:
--------------------------------------------------------------------------------
1 | #ifndef PUBLIC_DEFINITIONS_H
2 | #define PUBLIC_DEFINITIONS_H
3 |
4 | #include "teamlog/logtypes.h"
5 |
6 | //limited length, measured in characters
7 | #define TS3_MAX_SIZE_CHANNEL_NAME 40
8 | #define TS3_MAX_SIZE_VIRTUALSERVER_NAME 64
9 | #define TS3_MAX_SIZE_CLIENT_NICKNAME 64
10 | #define TS3_MIN_SIZE_CLIENT_NICKNAME 3
11 | #define TS3_MAX_SIZE_REASON_MESSAGE 80
12 |
13 | //limited length, measured in bytes (utf8 encoded)
14 | #define TS3_MAX_SIZE_TEXTMESSAGE 8192
15 | #define TS3_MAX_SIZE_CHANNEL_TOPIC 255
16 | #define TS3_MAX_SIZE_CHANNEL_DESCRIPTION 8192
17 | #define TS3_MAX_SIZE_VIRTUALSERVER_WELCOMEMESSAGE 1024
18 | #define TS3_SIZE_MYTSID 44
19 |
20 | //minimum amount of seconds before a clientID that was in use can be assigned to a new client
21 | #define TS3_MIN_SECONDS_CLIENTID_REUSE 300
22 |
23 | #if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
24 | typedef unsigned __int16 anyID;
25 | typedef unsigned __int64 uint64;
26 | #ifdef BUILDING_DLL
27 | #define EXPORTDLL __declspec(dllexport)
28 | #else
29 | #define EXPORTDLL
30 | #endif
31 | #else
32 | #include
33 | typedef uint16_t anyID;
34 | typedef uint64_t uint64;
35 | #ifdef BUILDING_DLL
36 | #define EXPORTDLL __attribute__ ((visibility("default")))
37 | #else
38 | #define EXPORTDLL
39 | #endif
40 | #endif
41 |
42 | enum TalkStatus {
43 | STATUS_NOT_TALKING = 0,
44 | STATUS_TALKING = 1,
45 | STATUS_TALKING_WHILE_DISABLED = 2,
46 | };
47 |
48 | enum CodecType {
49 | CODEC_SPEEX_NARROWBAND = 0, //mono, 16bit, 8kHz, bitrate dependent on the quality setting
50 | CODEC_SPEEX_WIDEBAND, //mono, 16bit, 16kHz, bitrate dependent on the quality setting
51 | CODEC_SPEEX_ULTRAWIDEBAND, //mono, 16bit, 32kHz, bitrate dependent on the quality setting
52 | CODEC_CELT_MONO, //mono, 16bit, 48kHz, bitrate dependent on the quality setting
53 | CODEC_OPUS_VOICE, //mono, 16bit, 48khz, bitrate dependent on the quality setting, optimized for voice
54 | CODEC_OPUS_MUSIC, //stereo, 16bit, 48khz, bitrate dependent on the quality setting, optimized for music
55 | };
56 |
57 | enum CodecEncryptionMode {
58 | CODEC_ENCRYPTION_PER_CHANNEL = 0,
59 | CODEC_ENCRYPTION_FORCED_OFF,
60 | CODEC_ENCRYPTION_FORCED_ON,
61 | };
62 |
63 | enum TextMessageTargetMode {
64 | TextMessageTarget_CLIENT=1,
65 | TextMessageTarget_CHANNEL,
66 | TextMessageTarget_SERVER,
67 | TextMessageTarget_MAX
68 | };
69 |
70 | enum MuteInputStatus {
71 | MUTEINPUT_NONE = 0,
72 | MUTEINPUT_MUTED,
73 | };
74 |
75 | enum MuteOutputStatus {
76 | MUTEOUTPUT_NONE = 0,
77 | MUTEOUTPUT_MUTED,
78 | };
79 |
80 | enum HardwareInputStatus {
81 | HARDWAREINPUT_DISABLED = 0,
82 | HARDWAREINPUT_ENABLED,
83 | };
84 |
85 | enum HardwareOutputStatus {
86 | HARDWAREOUTPUT_DISABLED = 0,
87 | HARDWAREOUTPUT_ENABLED,
88 | };
89 |
90 | enum InputDeactivationStatus {
91 | INPUT_ACTIVE = 0,
92 | INPUT_DEACTIVATED = 1,
93 | };
94 |
95 | enum ReasonIdentifier {
96 | REASON_NONE = 0, //no reason data
97 | REASON_MOVED = 1, //{SectionInvoker}
98 | REASON_SUBSCRIPTION = 2, //no reason data
99 | REASON_LOST_CONNECTION = 3, //reasonmsg=reason
100 | REASON_KICK_CHANNEL = 4, //{SectionInvoker} reasonmsg=reason //{SectionInvoker} is only added server->client
101 | REASON_KICK_SERVER = 5, //{SectionInvoker} reasonmsg=reason //{SectionInvoker} is only added server->client
102 | REASON_KICK_SERVER_BAN = 6, //{SectionInvoker} reasonmsg=reason bantime=time //{SectionInvoker} is only added server->client
103 | REASON_SERVERSTOP = 7, //reasonmsg=reason
104 | REASON_CLIENTDISCONNECT = 8, //reasonmsg=reason
105 | REASON_CHANNELUPDATE = 9, //no reason data
106 | REASON_CHANNELEDIT = 10, //{SectionInvoker}
107 | REASON_CLIENTDISCONNECT_SERVER_SHUTDOWN = 11, //reasonmsg=reason
108 | };
109 |
110 | enum ChannelProperties {
111 | CHANNEL_NAME = 0, //Available for all channels that are "in view", always up-to-date
112 | CHANNEL_TOPIC, //Available for all channels that are "in view", always up-to-date
113 | CHANNEL_DESCRIPTION, //Must be requested (=> requestChannelDescription)
114 | CHANNEL_PASSWORD, //not available client side
115 | CHANNEL_CODEC, //Available for all channels that are "in view", always up-to-date
116 | CHANNEL_CODEC_QUALITY, //Available for all channels that are "in view", always up-to-date
117 | CHANNEL_MAXCLIENTS, //Available for all channels that are "in view", always up-to-date
118 | CHANNEL_MAXFAMILYCLIENTS, //Available for all channels that are "in view", always up-to-date
119 | CHANNEL_ORDER, //Available for all channels that are "in view", always up-to-date
120 | CHANNEL_FLAG_PERMANENT, //Available for all channels that are "in view", always up-to-date
121 | CHANNEL_FLAG_SEMI_PERMANENT, //Available for all channels that are "in view", always up-to-date
122 | CHANNEL_FLAG_DEFAULT, //Available for all channels that are "in view", always up-to-date
123 | CHANNEL_FLAG_PASSWORD, //Available for all channels that are "in view", always up-to-date
124 | CHANNEL_CODEC_LATENCY_FACTOR, //Available for all channels that are "in view", always up-to-date
125 | CHANNEL_CODEC_IS_UNENCRYPTED, //Available for all channels that are "in view", always up-to-date
126 | CHANNEL_SECURITY_SALT, //Not available client side, not used in teamspeak, only SDK. Sets the options+salt for security hash.
127 | CHANNEL_DELETE_DELAY, //How many seconds to wait before deleting this channel
128 | CHANNEL_ENDMARKER,
129 | };
130 |
131 | enum ClientProperties {
132 | CLIENT_UNIQUE_IDENTIFIER = 0, //automatically up-to-date for any client "in view", can be used to identify this particular client installation
133 | CLIENT_NICKNAME, //automatically up-to-date for any client "in view"
134 | CLIENT_VERSION, //for other clients than ourself, this needs to be requested (=> requestClientVariables)
135 | CLIENT_PLATFORM, //for other clients than ourself, this needs to be requested (=> requestClientVariables)
136 | CLIENT_FLAG_TALKING, //automatically up-to-date for any client that can be heard (in room / whisper)
137 | CLIENT_INPUT_MUTED, //automatically up-to-date for any client "in view", this clients microphone mute status
138 | CLIENT_OUTPUT_MUTED, //automatically up-to-date for any client "in view", this clients headphones/speakers/mic combined mute status
139 | CLIENT_OUTPUTONLY_MUTED, //automatically up-to-date for any client "in view", this clients headphones/speakers only mute status
140 | CLIENT_INPUT_HARDWARE, //automatically up-to-date for any client "in view", this clients microphone hardware status (is the capture device opened?)
141 | CLIENT_OUTPUT_HARDWARE, //automatically up-to-date for any client "in view", this clients headphone/speakers hardware status (is the playback device opened?)
142 | CLIENT_INPUT_DEACTIVATED, //only usable for ourself, not propagated to the network
143 | CLIENT_IDLE_TIME, //internal use
144 | CLIENT_DEFAULT_CHANNEL, //only usable for ourself, the default channel we used to connect on our last connection attempt
145 | CLIENT_DEFAULT_CHANNEL_PASSWORD, //internal use
146 | CLIENT_SERVER_PASSWORD, //internal use
147 | CLIENT_META_DATA, //automatically up-to-date for any client "in view", not used by TeamSpeak, free storage for sdk users
148 | CLIENT_IS_MUTED, //only make sense on the client side locally, "1" if this client is currently muted by us, "0" if he is not
149 | CLIENT_IS_RECORDING, //automatically up-to-date for any client "in view"
150 | CLIENT_VOLUME_MODIFICATOR, //internal use
151 | CLIENT_VERSION_SIGN, //sign
152 | CLIENT_SECURITY_HASH, //SDK use, not used by teamspeak. Hash is provided by an outside source. A channel will use the security salt + other client data to calculate a hash, which must be the same as the one provided here.
153 | CLIENT_ENCRYPTION_CIPHERS, //internal use
154 | CLIENT_ENDMARKER,
155 | };
156 |
157 | enum VirtualServerProperties {
158 | VIRTUALSERVER_UNIQUE_IDENTIFIER = 0, //available when connected, can be used to identify this particular server installation
159 | VIRTUALSERVER_NAME, //available and always up-to-date when connected
160 | VIRTUALSERVER_WELCOMEMESSAGE, //available when connected, (=> requestServerVariables)
161 | VIRTUALSERVER_PLATFORM, //available when connected
162 | VIRTUALSERVER_VERSION, //available when connected
163 | VIRTUALSERVER_MAXCLIENTS, //only available on request (=> requestServerVariables), stores the maximum number of clients that may currently join the server
164 | VIRTUALSERVER_PASSWORD, //not available to clients, the server password
165 | VIRTUALSERVER_CLIENTS_ONLINE, //only available on request (=> requestServerVariables),
166 | VIRTUALSERVER_CHANNELS_ONLINE, //only available on request (=> requestServerVariables),
167 | VIRTUALSERVER_CREATED, //available when connected, stores the time when the server was created
168 | VIRTUALSERVER_UPTIME, //only available on request (=> requestServerVariables), the time since the server was started
169 | VIRTUALSERVER_CODEC_ENCRYPTION_MODE, //available and always up-to-date when connected
170 | VIRTUALSERVER_ENCRYPTION_CIPHERS, //internal use
171 | VIRTUALSERVER_ENDMARKER,
172 | };
173 |
174 | enum ConnectionProperties {
175 | CONNECTION_PING = 0, //average latency for a round trip through and back this connection
176 | CONNECTION_PING_DEVIATION, //standard deviation of the above average latency
177 | CONNECTION_CONNECTED_TIME, //how long the connection exists already
178 | CONNECTION_IDLE_TIME, //how long since the last action of this client
179 | CONNECTION_CLIENT_IP, //IP of this client (as seen from the server side)
180 | CONNECTION_CLIENT_PORT, //Port of this client (as seen from the server side)
181 | CONNECTION_SERVER_IP, //IP of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side
182 | CONNECTION_SERVER_PORT, //Port of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side
183 | CONNECTION_PACKETS_SENT_SPEECH, //how many Speech packets were sent through this connection
184 | CONNECTION_PACKETS_SENT_KEEPALIVE,
185 | CONNECTION_PACKETS_SENT_CONTROL,
186 | CONNECTION_PACKETS_SENT_TOTAL, //how many packets were sent totally (this is PACKETS_SENT_SPEECH + PACKETS_SENT_KEEPALIVE + PACKETS_SENT_CONTROL)
187 | CONNECTION_BYTES_SENT_SPEECH,
188 | CONNECTION_BYTES_SENT_KEEPALIVE,
189 | CONNECTION_BYTES_SENT_CONTROL,
190 | CONNECTION_BYTES_SENT_TOTAL,
191 | CONNECTION_PACKETS_RECEIVED_SPEECH,
192 | CONNECTION_PACKETS_RECEIVED_KEEPALIVE,
193 | CONNECTION_PACKETS_RECEIVED_CONTROL,
194 | CONNECTION_PACKETS_RECEIVED_TOTAL,
195 | CONNECTION_BYTES_RECEIVED_SPEECH,
196 | CONNECTION_BYTES_RECEIVED_KEEPALIVE,
197 | CONNECTION_BYTES_RECEIVED_CONTROL,
198 | CONNECTION_BYTES_RECEIVED_TOTAL,
199 | CONNECTION_PACKETLOSS_SPEECH,
200 | CONNECTION_PACKETLOSS_KEEPALIVE,
201 | CONNECTION_PACKETLOSS_CONTROL,
202 | CONNECTION_PACKETLOSS_TOTAL, //the probability with which a packet round trip failed because a packet was lost
203 | CONNECTION_SERVER2CLIENT_PACKETLOSS_SPEECH, //the probability with which a speech packet failed from the server to the client
204 | CONNECTION_SERVER2CLIENT_PACKETLOSS_KEEPALIVE,
205 | CONNECTION_SERVER2CLIENT_PACKETLOSS_CONTROL,
206 | CONNECTION_SERVER2CLIENT_PACKETLOSS_TOTAL,
207 | CONNECTION_CLIENT2SERVER_PACKETLOSS_SPEECH,
208 | CONNECTION_CLIENT2SERVER_PACKETLOSS_KEEPALIVE,
209 | CONNECTION_CLIENT2SERVER_PACKETLOSS_CONTROL,
210 | CONNECTION_CLIENT2SERVER_PACKETLOSS_TOTAL,
211 | CONNECTION_BANDWIDTH_SENT_LAST_SECOND_SPEECH, //howmany bytes of speech packets we sent during the last second
212 | CONNECTION_BANDWIDTH_SENT_LAST_SECOND_KEEPALIVE,
213 | CONNECTION_BANDWIDTH_SENT_LAST_SECOND_CONTROL,
214 | CONNECTION_BANDWIDTH_SENT_LAST_SECOND_TOTAL,
215 | CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_SPEECH, //howmany bytes/s of speech packets we sent in average during the last minute
216 | CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_KEEPALIVE,
217 | CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_CONTROL,
218 | CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_TOTAL,
219 | CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_SPEECH,
220 | CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_KEEPALIVE,
221 | CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_CONTROL,
222 | CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_TOTAL,
223 | CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_SPEECH,
224 | CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_KEEPALIVE,
225 | CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_CONTROL,
226 | CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_TOTAL,
227 | CONNECTION_ENDMARKER,
228 | };
229 |
230 | typedef struct {
231 | float x; /* X co-ordinate in 3D space. */
232 | float y; /* Y co-ordinate in 3D space. */
233 | float z; /* Z co-ordinate in 3D space. */
234 | } TS3_VECTOR;
235 |
236 | enum GroupWhisperType {
237 | GROUPWHISPERTYPE_SERVERGROUP = 0,
238 | GROUPWHISPERTYPE_CHANNELGROUP = 1,
239 | GROUPWHISPERTYPE_CHANNELCOMMANDER = 2,
240 | GROUPWHISPERTYPE_ALLCLIENTS = 3,
241 | GROUPWHISPERTYPE_ENDMARKER,
242 | };
243 |
244 | enum GroupWhisperTargetMode {
245 | GROUPWHISPERTARGETMODE_ALL = 0,
246 | GROUPWHISPERTARGETMODE_CURRENTCHANNEL = 1,
247 | GROUPWHISPERTARGETMODE_PARENTCHANNEL = 2,
248 | GROUPWHISPERTARGETMODE_ALLPARENTCHANNELS = 3,
249 | GROUPWHISPERTARGETMODE_CHANNELFAMILY = 4,
250 | GROUPWHISPERTARGETMODE_ANCESTORCHANNELFAMILY = 5,
251 | GROUPWHISPERTARGETMODE_SUBCHANNELS = 6,
252 | GROUPWHISPERTARGETMODE_ENDMARKER,
253 | };
254 |
255 | enum MonoSoundDestination{
256 | MONO_SOUND_DESTINATION_ALL =0, /* Send mono sound to all available speakers */
257 | MONO_SOUND_DESTINATION_FRONT_CENTER =1, /* Send mono sound to front center speaker if available */
258 | MONO_SOUND_DESTINATION_FRONT_LEFT_AND_RIGHT =2 /* Send mono sound to front left/right speakers if available */
259 | };
260 |
261 | enum SecuritySaltOptions {
262 | SECURITY_SALT_CHECK_NICKNAME = 1, /* put nickname into security hash */
263 | SECURITY_SALT_CHECK_META_DATA = 2 /* put (game)meta data into security hash */
264 | };
265 |
266 | /*this enum is used to disable client commands on the server*/
267 | enum ClientCommand{
268 | CLIENT_COMMAND_requestConnectionInfo = 0,
269 | CLIENT_COMMAND_requestClientMove = 1,
270 | CLIENT_COMMAND_requestXXMuteClients = 2,
271 | CLIENT_COMMAND_requestClientKickFromXXX = 3,
272 | CLIENT_COMMAND_flushChannelCreation = 4,
273 | CLIENT_COMMAND_flushChannelUpdates = 5,
274 | CLIENT_COMMAND_requestChannelMove = 6,
275 | CLIENT_COMMAND_requestChannelDelete = 7,
276 | CLIENT_COMMAND_requestChannelDescription = 8,
277 | CLIENT_COMMAND_requestChannelXXSubscribeXXX = 9,
278 | CLIENT_COMMAND_requestServerConnectionInfo = 10,
279 | CLIENT_COMMAND_requestSendXXXTextMsg = 11,
280 | CLIENT_COMMAND_filetransfers = 12,
281 | CLIENT_COMMAND_ENDMARKER
282 | };
283 |
284 | /* Access Control List*/
285 | enum ACLType{
286 | ACL_NONE = 0,
287 | ACL_WHITE_LIST = 1,
288 | ACL_BLACK_LIST = 2
289 | };
290 |
291 | /* file transfer actions*/
292 | enum FTAction{
293 | FT_INIT_SERVER = 0,
294 | FT_INIT_CHANNEL = 1,
295 | FT_UPLOAD = 2,
296 | FT_DOWNLOAD = 3,
297 | FT_DELETE = 4,
298 | FT_CREATEDIR = 5,
299 | FT_RENAME = 6,
300 | FT_FILELIST = 7,
301 | FT_FILEINFO = 8
302 | };
303 |
304 | /* file transfer status */
305 | enum FileTransferState {
306 | FILETRANSFER_INITIALISING = 0,
307 | FILETRANSFER_ACTIVE,
308 | FILETRANSFER_FINISHED,
309 | };
310 |
311 | /* file transfer types */
312 | enum {
313 | FileListType_Directory = 0,
314 | FileListType_File,
315 | };
316 |
317 | /* some structs to handle variables in callbacks */
318 | #define MAX_VARIABLES_EXPORT_COUNT 64
319 | struct VariablesExportItem{
320 | unsigned char itemIsValid; /* This item has valid values. ignore this item if 0 */
321 | unsigned char proposedIsSet; /* The value in proposed is set. if 0 ignore proposed */
322 | const char* current; /* current value (stored in memory) */
323 | const char* proposed; /* New value to change to (const, so no updates please) */
324 | };
325 |
326 | struct VariablesExport{
327 | struct VariablesExportItem items[MAX_VARIABLES_EXPORT_COUNT];
328 | };
329 |
330 | struct ClientMiniExport{
331 | anyID ID;
332 | uint64 channel;
333 | const char* ident;
334 | const char* nickname;
335 | };
336 |
337 | struct TransformFilePathExport{
338 | uint64 channel;
339 | const char* filename;
340 | int action;
341 | int transformedFileNameMaxSize;
342 | int channelPathMaxSize;
343 | };
344 |
345 | struct TransformFilePathExportReturns{
346 | char* transformedFileName;
347 | char* channelPath;
348 | int logFileAction;
349 | };
350 |
351 | struct FileTransferCallbackExport{
352 | anyID clientID;
353 | anyID transferID;
354 | anyID remoteTransferID;
355 | unsigned int status;
356 | const char* statusMessage;
357 | uint64 remotefileSize;
358 | uint64 bytes;
359 | int isSender;
360 | };
361 |
362 | /*define for file transfer bandwith limits*/
363 | #define BANDWIDTH_LIMIT_UNLIMITED 0xFFFFFFFFFFFFFFFFll
364 |
365 |
366 | /*defines for speaker locations used by some sound callbacks*/
367 | #ifndef SPEAKER_FRONT_LEFT
368 | #define SPEAKER_FRONT_LEFT 0x1
369 | #define SPEAKER_FRONT_RIGHT 0x2
370 | #define SPEAKER_FRONT_CENTER 0x4
371 | #define SPEAKER_LOW_FREQUENCY 0x8
372 | #define SPEAKER_BACK_LEFT 0x10
373 | #define SPEAKER_BACK_RIGHT 0x20
374 | #define SPEAKER_FRONT_LEFT_OF_CENTER 0x40
375 | #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80
376 | #define SPEAKER_BACK_CENTER 0x100
377 | #define SPEAKER_SIDE_LEFT 0x200
378 | #define SPEAKER_SIDE_RIGHT 0x400
379 | #define SPEAKER_TOP_CENTER 0x800
380 | #define SPEAKER_TOP_FRONT_LEFT 0x1000
381 | #define SPEAKER_TOP_FRONT_CENTER 0x2000
382 | #define SPEAKER_TOP_FRONT_RIGHT 0x4000
383 | #define SPEAKER_TOP_BACK_LEFT 0x8000
384 | #define SPEAKER_TOP_BACK_CENTER 0x10000
385 | #define SPEAKER_TOP_BACK_RIGHT 0x20000
386 | #endif
387 | #define SPEAKER_HEADPHONES_LEFT 0x10000000
388 | #define SPEAKER_HEADPHONES_RIGHT 0x20000000
389 | #define SPEAKER_MONO 0x40000000
390 |
391 | #endif /*PUBLIC_DEFINITIONS_H*/
392 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamspeak/public_errors.h:
--------------------------------------------------------------------------------
1 | #ifndef PUBLIC_ERRORS_H
2 | #define PUBLIC_ERRORS_H
3 |
4 | //The idea here is: the values are 2 bytes wide, the first byte identifies the group, the second the count within that group
5 |
6 | enum Ts3ErrorType {
7 | //general
8 | ERROR_ok = 0x0000,
9 | ERROR_undefined = 0x0001,
10 | ERROR_not_implemented = 0x0002,
11 | ERROR_ok_no_update = 0x0003,
12 | ERROR_dont_notify = 0x0004,
13 | ERROR_lib_time_limit_reached = 0x0005,
14 | ERROR_out_of_memory = 0x0006,
15 | ERROR_canceled = 0x0007,
16 |
17 | //dunno
18 | ERROR_command_not_found = 0x0100,
19 | ERROR_unable_to_bind_network_port = 0x0101,
20 | ERROR_no_network_port_available = 0x0102,
21 | ERROR_port_already_in_use = 0x0103,
22 |
23 | //client
24 | ERROR_client_invalid_id = 0x0200,
25 | ERROR_client_nickname_inuse = 0x0201,
26 | ERROR_client_protocol_limit_reached = 0x0203,
27 | ERROR_client_invalid_type = 0x0204,
28 | ERROR_client_already_subscribed = 0x0205,
29 | ERROR_client_not_logged_in = 0x0206,
30 | ERROR_client_could_not_validate_identity = 0x0207,
31 | ERROR_client_version_outdated = 0x020a,
32 | ERROR_client_is_flooding = 0x020c,
33 | ERROR_client_hacked = 0x020d,
34 | ERROR_client_cannot_verify_now = 0x020e,
35 | ERROR_client_login_not_permitted = 0x020f,
36 | ERROR_client_not_subscribed = 0x0210,
37 |
38 | //channel
39 | ERROR_channel_invalid_id = 0x0300,
40 | ERROR_channel_protocol_limit_reached = 0x0301,
41 | ERROR_channel_already_in = 0x0302,
42 | ERROR_channel_name_inuse = 0x0303,
43 | ERROR_channel_not_empty = 0x0304,
44 | ERROR_channel_can_not_delete_default = 0x0305,
45 | ERROR_channel_default_require_permanent = 0x0306,
46 | ERROR_channel_invalid_flags = 0x0307,
47 | ERROR_channel_parent_not_permanent = 0x0308,
48 | ERROR_channel_maxclients_reached = 0x0309,
49 | ERROR_channel_maxfamily_reached = 0x030a,
50 | ERROR_channel_invalid_order = 0x030b,
51 | ERROR_channel_no_filetransfer_supported = 0x030c,
52 | ERROR_channel_invalid_password = 0x030d,
53 | ERROR_channel_invalid_security_hash = 0x030f, //note 0x030e is defined in public_rare_errors;
54 |
55 | //server
56 | ERROR_server_invalid_id = 0x0400,
57 | ERROR_server_running = 0x0401,
58 | ERROR_server_is_shutting_down = 0x0402,
59 | ERROR_server_maxclients_reached = 0x0403,
60 | ERROR_server_invalid_password = 0x0404,
61 | ERROR_server_is_virtual = 0x0407,
62 | ERROR_server_is_not_running = 0x0409,
63 | ERROR_server_is_booting = 0x040a,
64 | ERROR_server_status_invalid = 0x040b,
65 | ERROR_server_version_outdated = 0x040d,
66 | ERROR_server_duplicate_running = 0x040e,
67 |
68 | //parameter
69 | ERROR_parameter_quote = 0x0600,
70 | ERROR_parameter_invalid_count = 0x0601,
71 | ERROR_parameter_invalid = 0x0602,
72 | ERROR_parameter_not_found = 0x0603,
73 | ERROR_parameter_convert = 0x0604,
74 | ERROR_parameter_invalid_size = 0x0605,
75 | ERROR_parameter_missing = 0x0606,
76 | ERROR_parameter_checksum = 0x0607,
77 |
78 | //unsorted, need further investigation
79 | ERROR_vs_critical = 0x0700,
80 | ERROR_connection_lost = 0x0701,
81 | ERROR_not_connected = 0x0702,
82 | ERROR_no_cached_connection_info = 0x0703,
83 | ERROR_currently_not_possible = 0x0704,
84 | ERROR_failed_connection_initialisation = 0x0705,
85 | ERROR_could_not_resolve_hostname = 0x0706,
86 | ERROR_invalid_server_connection_handler_id = 0x0707,
87 | ERROR_could_not_initialise_input_manager = 0x0708,
88 | ERROR_clientlibrary_not_initialised = 0x0709,
89 | ERROR_serverlibrary_not_initialised = 0x070a,
90 | ERROR_whisper_too_many_targets = 0x070b,
91 | ERROR_whisper_no_targets = 0x070c,
92 | ERROR_connection_ip_protocol_missing = 0x070d,
93 | //reserved = 0x070e,
94 | ERROR_illegal_server_license = 0x070f,
95 |
96 | //file transfer
97 | ERROR_file_invalid_name = 0x0800,
98 | ERROR_file_invalid_permissions = 0x0801,
99 | ERROR_file_already_exists = 0x0802,
100 | ERROR_file_not_found = 0x0803,
101 | ERROR_file_io_error = 0x0804,
102 | ERROR_file_invalid_transfer_id = 0x0805,
103 | ERROR_file_invalid_path = 0x0806,
104 | ERROR_file_no_files_available = 0x0807,
105 | ERROR_file_overwrite_excludes_resume = 0x0808,
106 | ERROR_file_invalid_size = 0x0809,
107 | ERROR_file_already_in_use = 0x080a,
108 | ERROR_file_could_not_open_connection = 0x080b,
109 | ERROR_file_no_space_left_on_device = 0x080c,
110 | ERROR_file_exceeds_file_system_maximum_size = 0x080d,
111 | ERROR_file_transfer_connection_timeout = 0x080e,
112 | ERROR_file_connection_lost = 0x080f,
113 | ERROR_file_exceeds_supplied_size = 0x0810,
114 | ERROR_file_transfer_complete = 0x0811,
115 | ERROR_file_transfer_canceled = 0x0812,
116 | ERROR_file_transfer_interrupted = 0x0813,
117 | ERROR_file_transfer_server_quota_exceeded = 0x0814,
118 | ERROR_file_transfer_client_quota_exceeded = 0x0815,
119 | ERROR_file_transfer_reset = 0x0816,
120 | ERROR_file_transfer_limit_reached = 0x0817,
121 |
122 | //sound
123 | ERROR_sound_preprocessor_disabled = 0x0900,
124 | ERROR_sound_internal_preprocessor = 0x0901,
125 | ERROR_sound_internal_encoder = 0x0902,
126 | ERROR_sound_internal_playback = 0x0903,
127 | ERROR_sound_no_capture_device_available = 0x0904,
128 | ERROR_sound_no_playback_device_available = 0x0905,
129 | ERROR_sound_could_not_open_capture_device = 0x0906,
130 | ERROR_sound_could_not_open_playback_device = 0x0907,
131 | ERROR_sound_handler_has_device = 0x0908,
132 | ERROR_sound_invalid_capture_device = 0x0909,
133 | ERROR_sound_invalid_playback_device = 0x090a,
134 | ERROR_sound_invalid_wave = 0x090b,
135 | ERROR_sound_unsupported_wave = 0x090c,
136 | ERROR_sound_open_wave = 0x090d,
137 | ERROR_sound_internal_capture = 0x090e,
138 | ERROR_sound_device_in_use = 0x090f,
139 | ERROR_sound_device_already_registerred = 0x0910,
140 | ERROR_sound_unknown_device = 0x0911,
141 | ERROR_sound_unsupported_frequency = 0x0912,
142 | ERROR_sound_invalid_channel_count = 0x0913,
143 | ERROR_sound_read_wave = 0x0914,
144 | ERROR_sound_need_more_data = 0x0915, //for internal purposes only
145 | ERROR_sound_device_busy = 0x0916, //for internal purposes only
146 | ERROR_sound_no_data = 0x0917,
147 | ERROR_sound_channel_mask_mismatch = 0x0918,
148 |
149 |
150 | //permissions
151 | ERROR_permissions_client_insufficient = 0x0a08,
152 | ERROR_permissions = 0x0a0c,
153 |
154 | //accounting
155 | ERROR_accounting_virtualserver_limit_reached = 0x0b00,
156 | ERROR_accounting_slot_limit_reached = 0x0b01,
157 | ERROR_accounting_license_file_not_found = 0x0b02,
158 | ERROR_accounting_license_date_not_ok = 0x0b03,
159 | ERROR_accounting_unable_to_connect_to_server = 0x0b04,
160 | ERROR_accounting_unknown_error = 0x0b05,
161 | ERROR_accounting_server_error = 0x0b06,
162 | ERROR_accounting_instance_limit_reached = 0x0b07,
163 | ERROR_accounting_instance_check_error = 0x0b08,
164 | ERROR_accounting_license_file_invalid = 0x0b09,
165 | ERROR_accounting_running_elsewhere = 0x0b0a,
166 | ERROR_accounting_instance_duplicated = 0x0b0b,
167 | ERROR_accounting_already_started = 0x0b0c,
168 | ERROR_accounting_not_started = 0x0b0d,
169 | ERROR_accounting_to_many_starts = 0x0b0e,
170 |
171 | //provisioning server
172 | ERROR_provisioning_invalid_password = 0x1100,
173 | ERROR_provisioning_invalid_request = 0x1101,
174 | ERROR_provisioning_no_slots_available = 0x1102,
175 | ERROR_provisioning_pool_missing = 0x1103,
176 | ERROR_provisioning_pool_unknown = 0x1104,
177 | ERROR_provisioning_unknown_ip_location = 0x1105,
178 | ERROR_provisioning_internal_tries_exceeded = 0x1106,
179 | ERROR_provisioning_too_many_slots_requested = 0x1107,
180 | ERROR_provisioning_too_many_reserved = 0x1108,
181 | ERROR_provisioning_could_not_connect = 0x1109,
182 | ERROR_provisioning_auth_server_not_connected = 0x1110,
183 | ERROR_provisioning_auth_data_too_large = 0x1111,
184 | ERROR_provisioning_already_initialized = 0x1112,
185 | ERROR_provisioning_not_initialized = 0x1113,
186 | ERROR_provisioning_connecting = 0x1114,
187 | ERROR_provisioning_already_connected = 0x1115,
188 | ERROR_provisioning_not_connected = 0x1116,
189 | ERROR_provisioning_io_error = 0x1117,
190 | ERROR_provisioning_invalid_timeout = 0x1118,
191 | ERROR_provisioning_ts3server_not_found = 0x1119,
192 | ERROR_provisioning_no_permission = 0x111A,
193 | };
194 | #endif
195 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamspeak/public_errors_rare.h:
--------------------------------------------------------------------------------
1 | #ifndef PUBLIC_ERRORS__RARE_H
2 | #define PUBLIC_ERRORS__RARE_H
3 |
4 | //The idea here is: the values are 2 bytes wide, the first byte identifies the group, the second the count within that group
5 |
6 | enum Ts3RareErrorType {
7 | //client
8 | ERROR_client_invalid_password = 0x0208,
9 | ERROR_client_too_many_clones_connected = 0x0209,
10 | ERROR_client_is_online = 0x020b,
11 |
12 | //channel
13 | ERROR_channel_is_private_channel = 0x030e,
14 | //note 0x030f is defined in public_errors;
15 |
16 | //database
17 | ERROR_database = 0x0500,
18 | ERROR_database_empty_result = 0x0501,
19 | ERROR_database_duplicate_entry = 0x0502,
20 | ERROR_database_no_modifications = 0x0503,
21 | ERROR_database_constraint = 0x0504,
22 | ERROR_database_reinvoke = 0x0505,
23 |
24 | //permissions
25 | ERROR_permission_invalid_group_id = 0x0a00,
26 | ERROR_permission_duplicate_entry = 0x0a01,
27 | ERROR_permission_invalid_perm_id = 0x0a02,
28 | ERROR_permission_empty_result = 0x0a03,
29 | ERROR_permission_default_group_forbidden = 0x0a04,
30 | ERROR_permission_invalid_size = 0x0a05,
31 | ERROR_permission_invalid_value = 0x0a06,
32 | ERROR_permissions_group_not_empty = 0x0a07,
33 | ERROR_permissions_insufficient_group_power = 0x0a09,
34 | ERROR_permissions_insufficient_permission_power = 0x0a0a,
35 | ERROR_permission_template_group_is_used = 0x0a0b,
36 | //0x0a0c is in public_errors.h
37 | ERROR_permission_used_by_integration = 0x0a0d,
38 |
39 | //server
40 | ERROR_server_deployment_active = 0x0405,
41 | ERROR_server_unable_to_stop_own_server = 0x0406,
42 | ERROR_server_wrong_machineid = 0x0408,
43 | ERROR_server_modal_quit = 0x040c,
44 | ERROR_server_time_difference_too_large = 0x040f,
45 | ERROR_server_blacklisted = 0x0410,
46 |
47 | //messages
48 | ERROR_message_invalid_id = 0x0c00,
49 |
50 | //ban
51 | ERROR_ban_invalid_id = 0x0d00,
52 | ERROR_connect_failed_banned = 0x0d01,
53 | ERROR_rename_failed_banned = 0x0d02,
54 | ERROR_ban_flooding = 0x0d03,
55 |
56 | //tts
57 | ERROR_tts_unable_to_initialize = 0x0e00,
58 |
59 | //privilege key
60 | ERROR_privilege_key_invalid = 0x0f00,
61 |
62 | //voip
63 | ERROR_voip_pjsua = 0x1000,
64 | ERROR_voip_already_initialized = 0x1001,
65 | ERROR_voip_too_many_accounts = 0x1002,
66 | ERROR_voip_invalid_account = 0x1003,
67 | ERROR_voip_internal_error = 0x1004,
68 | ERROR_voip_invalid_connectionId = 0x1005,
69 | ERROR_voip_cannot_answer_initiated_call = 0x1006,
70 | ERROR_voip_not_initialized = 0x1007,
71 |
72 | //ed25519
73 | ERROR_ed25519_rng_fail = 0x1300,
74 | ERROR_ed25519_signature_invalid = 0x1301,
75 | ERROR_ed25519_invalid_key = 0x1302,
76 | ERROR_ed25519_unable_to_create_valid_key = 0x1303,
77 | ERROR_ed25519_out_of_memory = 0x1304,
78 | ERROR_ed25519_exists = 0x1305,
79 | ERROR_ed25519_read_beyond_eof = 0x1306,
80 | ERROR_ed25519_write_beyond_eof = 0x1307,
81 | ERROR_ed25519_version = 0x1308,
82 | ERROR_ed25519_invalid = 0x1309,
83 | ERROR_ed25519_invalid_date = 0x130A,
84 | ERROR_ed25519_unauthorized = 0x130B,
85 | ERROR_ed25519_invalid_type = 0x130C,
86 | ERROR_ed25519_address_nomatch = 0x130D,
87 | ERROR_ed25519_not_valid_yet = 0x130E,
88 | ERROR_ed25519_expired = 0x130F,
89 | ERROR_ed25519_index_out_of_range = 0x1310,
90 | ERROR_ed25519_invalid_size = 0x1311,
91 |
92 | //mytsid - client
93 | ERROR_invalid_mytsid_data = 0x1200,
94 | ERROR_invalid_integration = 0x1201,
95 | };
96 |
97 | #endif
98 |
--------------------------------------------------------------------------------
/TS3Hook/include/teamspeak/public_rare_definitions.h:
--------------------------------------------------------------------------------
1 | #ifndef PUBLIC_RARE_DEFINITIONS_H
2 | #define PUBLIC_RARE_DEFINITIONS_H
3 |
4 | #include "public_definitions.h"
5 |
6 | //limited length, measured in characters
7 | #define TS3_MAX_SIZE_CLIENT_NICKNAME_NONSDK 30
8 | #define TS3_MIN_SIZE_CLIENT_NICKNAME_NONSDK 3
9 | #define TS3_MAX_SIZE_AWAY_MESSAGE 80
10 | #define TS3_MAX_SIZE_GROUP_NAME 30
11 | #define TS3_MAX_SIZE_TALK_REQUEST_MESSAGE 50
12 | #define TS3_MAX_SIZE_COMPLAIN_MESSAGE 200
13 | #define TS3_MAX_SIZE_CLIENT_DESCRIPTION 200
14 | #define TS3_MAX_SIZE_HOST_MESSAGE 200
15 | #define TS3_MAX_SIZE_HOSTBUTTON_TOOLTIP 50
16 | #define TS3_MAX_SIZE_POKE_MESSAGE 100
17 | #define TS3_MAX_SIZE_OFFLINE_MESSAGE 4096
18 | #define TS3_MAX_SIZE_OFFLINE_MESSAGE_SUBJECT 200
19 |
20 | //limited length, measured in bytes (utf8 encoded)
21 | #define TS3_MAX_SIZE_PLUGIN_COMMAND 1024*8
22 | #define TS3_MAX_SIZE_VIRTUALSERVER_HOSTBANNER_GFX_URL 2000
23 |
24 |
25 | enum GroupShowNameTreeMode {
26 | GroupShowNameTreeMode_NONE= 0, //dont group show name
27 | GroupShowNameTreeMode_BEFORE, //show group name before client name
28 | GroupShowNameTreeMode_BEHIND //show group name behind client name
29 | };
30 |
31 | enum PluginTargetMode {
32 | PluginCommandTarget_CURRENT_CHANNEL=0, //send plugincmd to all clients in current channel
33 | PluginCommandTarget_SERVER, //send plugincmd to all clients on server
34 | PluginCommandTarget_CLIENT, //send plugincmd to all given client ids
35 | PluginCommandTarget_CURRENT_CHANNEL_SUBSCRIBED_CLIENTS, //send plugincmd to all subscribed clients in current channel
36 | PluginCommandTarget_MAX
37 | };
38 |
39 | enum {
40 | SERVER_BINDING_VIRTUALSERVER=0,
41 | SERVER_BINDING_SERVERQUERY =1,
42 | SERVER_BINDING_FILETRANSFER =2,
43 | };
44 |
45 | enum HostMessageMode {
46 | HostMessageMode_NONE=0, //dont display anything
47 | HostMessageMode_LOG, //display message inside log
48 | HostMessageMode_MODAL, //display message inside a modal dialog
49 | HostMessageMode_MODALQUIT //display message inside a modal dialog and quit/close server/connection
50 | };
51 |
52 | enum HostBannerMode {
53 | HostBannerMode_NO_ADJUST=0, //Do not adjust
54 | HostBannerMode_ADJUST_IGNORE_ASPECT, //Adjust but ignore aspect ratio
55 | HostBannerMode_ADJUST_KEEP_ASPECT, //Adjust and keep aspect ratio
56 | };
57 |
58 | enum ClientType {
59 | ClientType_NORMAL = 0,
60 | ClientType_SERVERQUERY,
61 | };
62 |
63 | enum AwayStatus {
64 | AWAY_NONE = 0,
65 | AWAY_ZZZ,
66 | };
67 |
68 | enum CommandLinePropertiesRare {
69 | #ifdef SERVER
70 | COMMANDLINE_CREATE_DEFAULT_VIRTUALSERVER= 0, //create default virtualserver
71 | COMMANDLINE_MACHINE_ID, //machine id (starts only virtualserver with given machineID
72 | COMMANDLINE_DEFAULT_VOICE_PORT,
73 | COMMANDLINE_VOICE_IP,
74 | COMMANDLINE_THREADS_VOICE_UDP,
75 | COMMANDLINE_LICENSEPATH,
76 | #ifndef SDK
77 | COMMANDLINE_FILETRANSFER_PORT,
78 | COMMANDLINE_FILETRANSFER_IP,
79 | COMMANDLINE_QUERY_PORT,
80 | COMMANDLINE_QUERY_IP,
81 | COMMANDLINE_QUERY_IP_WHITELIST,
82 | COMMANDLINE_QUERY_IP_BLACKLIST,
83 | COMMANDLINE_CLEAR_DATABASE,
84 | COMMANDLINE_SERVERADMIN_PASSWORD,
85 | COMMANDLINE_DBPLUGIN,
86 | COMMANDLINE_DBPLUGINPARAMETER,
87 | COMMANDLINE_DBSQLPATH,
88 | COMMANDLINE_DBSQLCREATEPATH,
89 | COMMANDLINE_DBCONNECTIONS,
90 | COMMANDLINE_LOGPATH,
91 | COMMANDLINE_CREATEINIFILE,
92 | COMMANDLINE_INIFILE,
93 | COMMANDLINE_LOGQUERYCOMMANDS,
94 | COMMANDLINE_DBCLIENTKEEPDAYS,
95 | COMMANDLINE_NO_PERMISSION_UPDATE,
96 | COMMANDLINE_OPEN_WIN_CONSOLE,
97 | COMMANDLINE_NO_PASSWORD_DIALOG,
98 | COMMANDLINE_LOGAPPEND,
99 | COMMANDLINE_QUERY_SKIPBRUTEFORCECHECK,
100 | COMMANDLINE_QUERY_BUFFER_MB,
101 | COMMANDLINE_HTTP_PROXY,
102 | COMMANDLINE_LICENSE_ACCEPTED,
103 | COMMANDLINE_SERVERQUERYDOCS_PATH,
104 | COMMANDLINE_QUERY_SSH_IP,
105 | COMMANDLINE_QUERY_SSH_PORT,
106 | COMMANDLINE_QUERY_PROTOCOLS,
107 | COMMANDLINE_QUERY_SSH_RSA_HOST_KEY,
108 | COMMANDLINE_QUERY_TIMEOUT,
109 | COMMANDLINE_VERSION,
110 | COMMANDLINE_CRASHDUMPSPATH,
111 | COMMANDLINE_DAEMON,
112 | COMMANDLINE_PID_FILE,
113 | #endif
114 | #else
115 | COMMANDLINE_NOTHING=0,
116 | #endif
117 | COMMANDLINE_ENDMARKER_RARE,
118 | };
119 |
120 | enum ServerInstancePropertiesRare {
121 | SERVERINSTANCE_DATABASE_VERSION= 0,
122 | SERVERINSTANCE_FILETRANSFER_PORT,
123 | SERVERINSTANCE_SERVER_ENTROPY,
124 | SERVERINSTANCE_MONTHLY_TIMESTAMP,
125 | SERVERINSTANCE_MAX_DOWNLOAD_TOTAL_BANDWIDTH,
126 | SERVERINSTANCE_MAX_UPLOAD_TOTAL_BANDWIDTH,
127 | SERVERINSTANCE_GUEST_SERVERQUERY_GROUP,
128 | SERVERINSTANCE_SERVERQUERY_FLOOD_COMMANDS, //how many commands we can issue while in the SERVERINSTANCE_SERVERQUERY_FLOOD_TIME window
129 | SERVERINSTANCE_SERVERQUERY_FLOOD_TIME, //time window in seconds for max command execution check
130 | SERVERINSTANCE_SERVERQUERY_BAN_TIME, //how many seconds someone get banned if he floods
131 | SERVERINSTANCE_TEMPLATE_SERVERADMIN_GROUP,
132 | SERVERINSTANCE_TEMPLATE_SERVERDEFAULT_GROUP,
133 | SERVERINSTANCE_TEMPLATE_CHANNELADMIN_GROUP,
134 | SERVERINSTANCE_TEMPLATE_CHANNELDEFAULT_GROUP,
135 | SERVERINSTANCE_PERMISSIONS_VERSION,
136 | SERVERINSTANCE_PENDING_CONNECTIONS_PER_IP,
137 | SERVERINSTANCE_SERVERQUERY_MAX_CONNECTIONS_PER_IP,
138 | SERVERINSTANCE_ENDMARKER_RARE,
139 | };
140 |
141 | enum VirtualServerPropertiesRare {
142 | VIRTUALSERVER_DUMMY_1 = VIRTUALSERVER_ENDMARKER,
143 | VIRTUALSERVER_DUMMY_2,
144 | VIRTUALSERVER_DUMMY_3,
145 | VIRTUALSERVER_DUMMY_4,
146 | VIRTUALSERVER_DUMMY_5,
147 | VIRTUALSERVER_DUMMY_6,
148 | VIRTUALSERVER_DUMMY_7,
149 | VIRTUALSERVER_DUMMY_8,
150 | VIRTUALSERVER_KEYPAIR, //internal use
151 | VIRTUALSERVER_HOSTMESSAGE, //available when connected, not updated while connected
152 | VIRTUALSERVER_HOSTMESSAGE_MODE, //available when connected, not updated while connected
153 | VIRTUALSERVER_FILEBASE, //not available to clients, stores the folder used for file transfers
154 | VIRTUALSERVER_DEFAULT_SERVER_GROUP, //the client permissions server group that a new client gets assigned
155 | VIRTUALSERVER_DEFAULT_CHANNEL_GROUP, //the channel permissions group that a new client gets assigned when joining a channel
156 | VIRTUALSERVER_FLAG_PASSWORD, //only available on request (=> requestServerVariables)
157 | VIRTUALSERVER_DEFAULT_CHANNEL_ADMIN_GROUP, //the channel permissions group that a client gets assigned when creating a channel
158 | VIRTUALSERVER_MAX_DOWNLOAD_TOTAL_BANDWIDTH, //only available on request (=> requestServerVariables)
159 | VIRTUALSERVER_MAX_UPLOAD_TOTAL_BANDWIDTH, //only available on request (=> requestServerVariables)
160 | VIRTUALSERVER_HOSTBANNER_URL, //available when connected, always up-to-date
161 | VIRTUALSERVER_HOSTBANNER_GFX_URL, //available when connected, always up-to-date
162 | VIRTUALSERVER_HOSTBANNER_GFX_INTERVAL, //available when connected, always up-to-date
163 | VIRTUALSERVER_COMPLAIN_AUTOBAN_COUNT, //only available on request (=> requestServerVariables)
164 | VIRTUALSERVER_COMPLAIN_AUTOBAN_TIME, //only available on request (=> requestServerVariables)
165 | VIRTUALSERVER_COMPLAIN_REMOVE_TIME, //only available on request (=> requestServerVariables)
166 | VIRTUALSERVER_MIN_CLIENTS_IN_CHANNEL_BEFORE_FORCED_SILENCE,//only available on request (=> requestServerVariables)
167 | VIRTUALSERVER_PRIORITY_SPEAKER_DIMM_MODIFICATOR, //available when connected, always up-to-date
168 | VIRTUALSERVER_ID, //available when connected
169 | VIRTUALSERVER_ANTIFLOOD_POINTS_TICK_REDUCE, //only available on request (=> requestServerVariables)
170 | VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_COMMAND_BLOCK, //only available on request (=> requestServerVariables)
171 | VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_IP_BLOCK, //only available on request (=> requestServerVariables)
172 | VIRTUALSERVER_CLIENT_CONNECTIONS, //only available on request (=> requestServerVariables)
173 | VIRTUALSERVER_QUERY_CLIENT_CONNECTIONS, //only available on request (=> requestServerVariables)
174 | VIRTUALSERVER_HOSTBUTTON_TOOLTIP, //available when connected, always up-to-date
175 | VIRTUALSERVER_HOSTBUTTON_URL, //available when connected, always up-to-date
176 | VIRTUALSERVER_HOSTBUTTON_GFX_URL, //available when connected, always up-to-date
177 | VIRTUALSERVER_QUERYCLIENTS_ONLINE, //only available on request (=> requestServerVariables)
178 | VIRTUALSERVER_DOWNLOAD_QUOTA, //only available on request (=> requestServerVariables)
179 | VIRTUALSERVER_UPLOAD_QUOTA, //only available on request (=> requestServerVariables)
180 | VIRTUALSERVER_MONTH_BYTES_DOWNLOADED, //only available on request (=> requestServerVariables)
181 | VIRTUALSERVER_MONTH_BYTES_UPLOADED, //only available on request (=> requestServerVariables)
182 | VIRTUALSERVER_TOTAL_BYTES_DOWNLOADED, //only available on request (=> requestServerVariables)
183 | VIRTUALSERVER_TOTAL_BYTES_UPLOADED, //only available on request (=> requestServerVariables)
184 | VIRTUALSERVER_PORT, //only available on request (=> requestServerVariables)
185 | VIRTUALSERVER_AUTOSTART, //only available on request (=> requestServerVariables)
186 | VIRTUALSERVER_MACHINE_ID, //only available on request (=> requestServerVariables)
187 | VIRTUALSERVER_NEEDED_IDENTITY_SECURITY_LEVEL, //only available on request (=> requestServerVariables)
188 | VIRTUALSERVER_LOG_CLIENT, //only available on request (=> requestServerVariables)
189 | VIRTUALSERVER_LOG_QUERY, //only available on request (=> requestServerVariables)
190 | VIRTUALSERVER_LOG_CHANNEL, //only available on request (=> requestServerVariables)
191 | VIRTUALSERVER_LOG_PERMISSIONS, //only available on request (=> requestServerVariables)
192 | VIRTUALSERVER_LOG_SERVER, //only available on request (=> requestServerVariables)
193 | VIRTUALSERVER_LOG_FILETRANSFER, //only available on request (=> requestServerVariables)
194 | VIRTUALSERVER_MIN_CLIENT_VERSION, //only available on request (=> requestServerVariables)
195 | VIRTUALSERVER_NAME_PHONETIC, //available when connected, always up-to-date
196 | VIRTUALSERVER_ICON_ID, //available when connected, always up-to-date
197 | VIRTUALSERVER_RESERVED_SLOTS, //available when connected, always up-to-date
198 | VIRTUALSERVER_TOTAL_PACKETLOSS_SPEECH, //only available on request (=> requestServerVariables)
199 | VIRTUALSERVER_TOTAL_PACKETLOSS_KEEPALIVE, //only available on request (=> requestServerVariables)
200 | VIRTUALSERVER_TOTAL_PACKETLOSS_CONTROL, //only available on request (=> requestServerVariables)
201 | VIRTUALSERVER_TOTAL_PACKETLOSS_TOTAL, //only available on request (=> requestServerVariables)
202 | VIRTUALSERVER_TOTAL_PING, //only available on request (=> requestServerVariables)
203 | VIRTUALSERVER_IP, //internal use | contains comma separated ip list
204 | VIRTUALSERVER_WEBLIST_ENABLED, //only available on request (=> requestServerVariables)
205 | VIRTUALSERVER_AUTOGENERATED_PRIVILEGEKEY, //internal use
206 | VIRTUALSERVER_ASK_FOR_PRIVILEGEKEY, //available when connected
207 | VIRTUALSERVER_HOSTBANNER_MODE, //available when connected, always up-to-date
208 | VIRTUALSERVER_CHANNEL_TEMP_DELETE_DELAY_DEFAULT, //available when connected, always up-to-date
209 | VIRTUALSERVER_MIN_ANDROID_VERSION, //only available on request (=> requestServerVariables)
210 | VIRTUALSERVER_MIN_IOS_VERSION, //only available on request (=> requestServerVariables)
211 | VIRTUALSERVER_MIN_WINPHONE_VERSION, //only available on request (=> requestServerVariables)
212 | VIRTUALSERVER_NICKNAME, //available when connected, always up-to-date
213 | VIRTUALSERVER_ACCOUNTING_TOKEN, //internal use | contains base64 encoded token data
214 | VIRTUALSERVER_PROTOCOL_VERIFY_KEYPAIR, //internal use
215 | VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_PLUGIN_BLOCK, //only available on request (=> requestServerVariables)
216 | VIRTUALSERVER_ENDMARKER_RARE
217 | };
218 |
219 | enum ChannelPropertiesRare {
220 | CHANNEL_DUMMY_2= CHANNEL_ENDMARKER,
221 | CHANNEL_DUMMY_3,
222 | CHANNEL_DUMMY_4,
223 | CHANNEL_DUMMY_5,
224 | CHANNEL_DUMMY_6,
225 | CHANNEL_DUMMY_7,
226 | CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, //Available for all channels that are "in view", always up-to-date
227 | CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED,//Available for all channels that are "in view", always up-to-date
228 | CHANNEL_FLAG_MAXFAMILYCLIENTS_INHERITED,//Available for all channels that are "in view", always up-to-date
229 | CHANNEL_FLAG_ARE_SUBSCRIBED, //Only available client side, stores whether we are subscribed to this channel
230 | CHANNEL_FILEPATH, //not available client side, the folder used for file-transfers for this channel
231 | CHANNEL_NEEDED_TALK_POWER, //Available for all channels that are "in view", always up-to-date
232 | CHANNEL_FORCED_SILENCE, //Available for all channels that are "in view", always up-to-date
233 | CHANNEL_NAME_PHONETIC, //Available for all channels that are "in view", always up-to-date
234 | CHANNEL_ICON_ID, //Available for all channels that are "in view", always up-to-date
235 | CHANNEL_BANNER_GFX_URL, //Available for all channels that are "in view", always up-to-date
236 | CHANNEL_BANNER_MODE, //Available for all channels that are "in view", always up-to-date
237 | CHANNEL_ENDMARKER_RARE,
238 | CHANNEL_DELETE_DELAY_DEADLINE = 127 //(for clientlibv2) expected delete time in monotonic clock seconds or 0 if nothing is expected
239 | };
240 |
241 | enum ClientPropertiesRare {
242 | CLIENT_DUMMY_4 = CLIENT_ENDMARKER,
243 | CLIENT_DUMMY_5,
244 | CLIENT_DUMMY_6,
245 | CLIENT_DUMMY_7,
246 | CLIENT_DUMMY_8,
247 | CLIENT_DUMMY_9,
248 | CLIENT_KEY_OFFSET, //internal use
249 | CLIENT_LAST_VAR_REQUEST, //internal use
250 | CLIENT_LOGIN_NAME, //used for serverquery clients, makes no sense on normal clients currently
251 | CLIENT_LOGIN_PASSWORD, //used for serverquery clients, makes no sense on normal clients currently
252 | CLIENT_DATABASE_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
253 | CLIENT_CHANNEL_GROUP_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
254 | CLIENT_SERVERGROUPS, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds all servergroups client belongs too
255 | CLIENT_CREATED, //this needs to be requested (=> requestClientVariables), first time this client connected to this server
256 | CLIENT_LASTCONNECTED, //this needs to be requested (=> requestClientVariables), last time this client connected to this server
257 | CLIENT_TOTALCONNECTIONS, //this needs to be requested (=> requestClientVariables), how many times this client connected to this server
258 | CLIENT_AWAY, //automatically up-to-date for any client "in view", this clients away status
259 | CLIENT_AWAY_MESSAGE, //automatically up-to-date for any client "in view", this clients away message
260 | CLIENT_TYPE, //automatically up-to-date for any client "in view", determines if this is a real client or a server-query connection
261 | CLIENT_FLAG_AVATAR, //automatically up-to-date for any client "in view", this client got an avatar
262 | CLIENT_TALK_POWER, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id
263 | CLIENT_TALK_REQUEST, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds timestamp where client requested to talk
264 | CLIENT_TALK_REQUEST_MSG, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds matter for the request
265 | CLIENT_DESCRIPTION, //automatically up-to-date for any client "in view"
266 | CLIENT_IS_TALKER, //automatically up-to-date for any client "in view"
267 | CLIENT_MONTH_BYTES_UPLOADED, //this needs to be requested (=> requestClientVariables)
268 | CLIENT_MONTH_BYTES_DOWNLOADED, //this needs to be requested (=> requestClientVariables)
269 | CLIENT_TOTAL_BYTES_UPLOADED, //this needs to be requested (=> requestClientVariables)
270 | CLIENT_TOTAL_BYTES_DOWNLOADED, //this needs to be requested (=> requestClientVariables)
271 | CLIENT_IS_PRIORITY_SPEAKER, //automatically up-to-date for any client "in view"
272 | CLIENT_UNREAD_MESSAGES, //automatically up-to-date for any client "in view"
273 | CLIENT_NICKNAME_PHONETIC, //automatically up-to-date for any client "in view"
274 | CLIENT_NEEDED_SERVERQUERY_VIEW_POWER, //automatically up-to-date for any client "in view"
275 | CLIENT_DEFAULT_TOKEN, //only usable for ourself, the default token we used to connect on our last connection attempt
276 | CLIENT_ICON_ID, //automatically up-to-date for any client "in view"
277 | CLIENT_IS_CHANNEL_COMMANDER, //automatically up-to-date for any client "in view"
278 | CLIENT_COUNTRY, //automatically up-to-date for any client "in view"
279 | CLIENT_CHANNEL_GROUP_INHERITED_CHANNEL_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, contains channel_id where the channel_group_id is set from
280 | CLIENT_BADGES, //automatically up-to-date for any client "in view", stores icons for partner badges
281 | CLIENT_MYTEAMSPEAK_ID, //automatically up-to-date for any client "in view", stores myteamspeak id
282 | CLIENT_INTEGRATIONS, //automatically up-to-date for any client "in view", stores integrations
283 | CLIENT_ACTIVE_INTEGRATIONS_INFO, //stores info from the myts server and contains the subscription info
284 | CLIENT_MYTS_AVATAR,
285 | CLIENT_SIGNED_BADGES,
286 | CLIENT_ENDMARKER_RARE,
287 | CLIENT_HW_ID = 127 //(for clientlibv2) unique hardware id
288 | };
289 |
290 | enum ConnectionPropertiesRare {
291 | CONNECTION_DUMMY_0= CONNECTION_ENDMARKER,
292 | CONNECTION_DUMMY_1,
293 | CONNECTION_DUMMY_2,
294 | CONNECTION_DUMMY_3,
295 | CONNECTION_DUMMY_4,
296 | CONNECTION_DUMMY_5,
297 | CONNECTION_DUMMY_6,
298 | CONNECTION_DUMMY_7,
299 | CONNECTION_DUMMY_8,
300 | CONNECTION_DUMMY_9,
301 | CONNECTION_FILETRANSFER_BANDWIDTH_SENT, //how many bytes per second are currently being sent by file transfers
302 | CONNECTION_FILETRANSFER_BANDWIDTH_RECEIVED, //how many bytes per second are currently being received by file transfers
303 | CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL, //how many bytes we received in total through file transfers
304 | CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL, //how many bytes we sent in total through file transfers
305 | CONNECTION_ENDMARKER_RARE,
306 | };
307 |
308 | enum BBCodeTags {
309 | BBCodeTag_B = 0x00000001,
310 | BBCodeTag_I = 0x00000002,
311 | BBCodeTag_U = 0x00000004,
312 | BBCodeTag_S = 0x00000008,
313 | BBCodeTag_SUP = 0x00000010,
314 | BBCodeTag_SUB = 0x00000020,
315 | BBCodeTag_COLOR = 0x00000040,
316 | BBCodeTag_SIZE = 0x00000080,
317 | BBCodeTag_group_text = 0x000000FF,
318 |
319 | BBCodeTag_LEFT = 0x00001000,
320 | BBCodeTag_RIGHT = 0x00002000,
321 | BBCodeTag_CENTER = 0x00004000,
322 | BBCodeTag_group_align = 0x00007000,
323 |
324 | BBCodeTag_URL = 0x00010000,
325 | BBCodeTag_IMAGE = 0x00020000,
326 | BBCodeTag_HR = 0x00040000,
327 |
328 | BBCodeTag_LIST = 0x00100000,
329 | BBCodeTag_LISTITEM = 0x00200000,
330 | BBCodeTag_group_list = 0x00300000,
331 |
332 | BBCodeTag_TABLE = 0x00400000,
333 | BBCodeTag_TR = 0x00800000,
334 | BBCodeTag_TH = 0x01000000,
335 | BBCodeTag_TD = 0x02000000,
336 | BBCodeTag_group_table = 0x03C00000,
337 |
338 | BBCodeTag_def_simple = BBCodeTag_B | BBCodeTag_I | BBCodeTag_U | BBCodeTag_S | BBCodeTag_SUP | BBCodeTag_SUB |BBCodeTag_COLOR | BBCodeTag_URL,
339 | BBCodeTag_def_simple_Img = BBCodeTag_def_simple | BBCodeTag_IMAGE,
340 | BBCodeTag_def_extended = BBCodeTag_group_text | BBCodeTag_group_align | BBCodeTag_URL | BBCodeTag_IMAGE | BBCodeTag_HR | BBCodeTag_group_list | BBCodeTag_group_table,
341 | };
342 |
343 | enum LicenseIssue {
344 | Blacklisted = 0,
345 | Greylisted
346 | };
347 |
348 | enum MytsDataUnsetFlags {
349 | MytsDataUnsetFlag_None = 0,
350 | MytsDataUnsetFlag_Badges = 1,
351 | MytsDataUnsetFlag_Avatar = 1 << 1,
352 |
353 | MytsDataUnsetFlag_All = MytsDataUnsetFlag_Badges | MytsDataUnsetFlag_Avatar // make sure "all" really contains all flags
354 | };
355 |
356 | typedef int(*ExtraBBCodeValidator)(void* userparam, const char* tag, const char* paramValue, int paramValueSize, const char* childValue, int childValueSize);
357 | typedef const char* (*ExtraBBCodeParamTransform)(void* userparam, const char* tag, const char* paramValue);
358 |
359 | #endif //PUBLIC_RARE_DEFINITIONS_H
360 |
--------------------------------------------------------------------------------
/TS3Hook/include/ts3_functions.h:
--------------------------------------------------------------------------------
1 | #ifndef TS3_FUNCTIONS_H
2 | #define TS3_FUNCTIONS_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include "teamspeak/clientlib_publicdefinitions.h"
9 | #include "teamspeak/public_definitions.h"
10 | #include "plugin_definitions.h"
11 |
12 | /* Functions exported to plugin from main binary */
13 | struct TS3Functions {
14 | unsigned int (*getClientLibVersion)(char** result);
15 | unsigned int (*getClientLibVersionNumber)(uint64* result);
16 | unsigned int (*spawnNewServerConnectionHandler)(int port, uint64* result);
17 | unsigned int (*destroyServerConnectionHandler)(uint64 serverConnectionHandlerID);
18 |
19 | /* Error handling */
20 | unsigned int (*getErrorMessage)(unsigned int errorCode, char** error);
21 |
22 | /* Memory management */
23 | unsigned int (*freeMemory)(void* pointer);
24 |
25 | /* Logging */
26 | unsigned int (*logMessage)(const char* logMessage, enum LogLevel severity, const char* channel, uint64 logID);
27 |
28 | /* Sound */
29 | unsigned int (*getPlaybackDeviceList)(const char* modeID, char**** result);
30 | unsigned int (*getPlaybackModeList)(char*** result);
31 | unsigned int (*getCaptureDeviceList)(const char* modeID, char**** result);
32 | unsigned int (*getCaptureModeList)(char*** result);
33 | unsigned int (*getDefaultPlaybackDevice)(const char* modeID, char*** result);
34 | unsigned int (*getDefaultPlayBackMode)(char** result);
35 | unsigned int (*getDefaultCaptureDevice)(const char* modeID, char*** result);
36 | unsigned int (*getDefaultCaptureMode)(char** result);
37 | unsigned int (*openPlaybackDevice)(uint64 serverConnectionHandlerID, const char* modeID, const char* playbackDevice);
38 | unsigned int (*openCaptureDevice)(uint64 serverConnectionHandlerID, const char* modeID, const char* captureDevice);
39 | unsigned int (*getCurrentPlaybackDeviceName)(uint64 serverConnectionHandlerID, char** result, int* isDefault);
40 | unsigned int (*getCurrentPlayBackMode)(uint64 serverConnectionHandlerID, char** result);
41 | unsigned int (*getCurrentCaptureDeviceName)(uint64 serverConnectionHandlerID, char** result, int* isDefault);
42 | unsigned int (*getCurrentCaptureMode)(uint64 serverConnectionHandlerID, char** result);
43 | unsigned int (*initiateGracefulPlaybackShutdown)(uint64 serverConnectionHandlerID);
44 | unsigned int (*closePlaybackDevice)(uint64 serverConnectionHandlerID);
45 | unsigned int (*closeCaptureDevice)(uint64 serverConnectionHandlerID);
46 | unsigned int (*activateCaptureDevice)(uint64 serverConnectionHandlerID);
47 | unsigned int (*playWaveFileHandle)(uint64 serverConnectionHandlerID, const char* path, int loop, uint64* waveHandle);
48 | unsigned int (*pauseWaveFileHandle)(uint64 serverConnectionHandlerID, uint64 waveHandle, int pause);
49 | unsigned int (*closeWaveFileHandle)(uint64 serverConnectionHandlerID, uint64 waveHandle);
50 | unsigned int (*playWaveFile)(uint64 serverConnectionHandlerID, const char* path);
51 | unsigned int (*registerCustomDevice)(const char* deviceID, const char* deviceDisplayName, int capFrequency, int capChannels, int playFrequency, int playChannels);
52 | unsigned int (*unregisterCustomDevice)(const char* deviceID);
53 | unsigned int (*processCustomCaptureData)(const char* deviceName, const short* buffer, int samples);
54 | unsigned int (*acquireCustomPlaybackData)(const char* deviceName, short* buffer, int samples);
55 |
56 | /* Preprocessor */
57 | unsigned int (*getPreProcessorInfoValueFloat)(uint64 serverConnectionHandlerID, const char* ident, float* result);
58 | unsigned int (*getPreProcessorConfigValue)(uint64 serverConnectionHandlerID, const char* ident, char** result);
59 | unsigned int (*setPreProcessorConfigValue)(uint64 serverConnectionHandlerID, const char* ident, const char* value);
60 |
61 | /* Encoder */
62 | unsigned int (*getEncodeConfigValue)(uint64 serverConnectionHandlerID, const char* ident, char** result);
63 |
64 | /* Playback */
65 | unsigned int (*getPlaybackConfigValueAsFloat)(uint64 serverConnectionHandlerID, const char* ident, float* result);
66 | unsigned int (*setPlaybackConfigValue)(uint64 serverConnectionHandlerID, const char* ident, const char* value);
67 | unsigned int (*setClientVolumeModifier)(uint64 serverConnectionHandlerID, anyID clientID, float value);
68 |
69 | /* Recording */
70 | unsigned int (*startVoiceRecording)(uint64 serverConnectionHandlerID);
71 | unsigned int (*stopVoiceRecording)(uint64 serverConnectionHandlerID);
72 |
73 | /* 3d sound positioning */
74 | unsigned int (*systemset3DListenerAttributes) (uint64 serverConnectionHandlerID, const TS3_VECTOR* position, const TS3_VECTOR* forward, const TS3_VECTOR* up);
75 | unsigned int (*set3DWaveAttributes) (uint64 serverConnectionHandlerID, uint64 waveHandle, const TS3_VECTOR* position);
76 | unsigned int (*systemset3DSettings) (uint64 serverConnectionHandlerID, float distanceFactor, float rolloffScale);
77 | unsigned int (*channelset3DAttributes) (uint64 serverConnectionHandlerID, anyID clientID, const TS3_VECTOR* position);
78 |
79 | /* Interaction with the server */
80 | unsigned int (*startConnection)(uint64 serverConnectionHandlerID, const char* identity, const char* ip, unsigned int port, const char* nickname,
81 | const char** defaultChannelArray, const char* defaultChannelPassword, const char* serverPassword);
82 | unsigned int (*stopConnection)(uint64 serverConnectionHandlerID, const char* quitMessage);
83 | unsigned int (*requestClientMove)(uint64 serverConnectionHandlerID, anyID clientID, uint64 newChannelID, const char* password, const char* returnCode);
84 | unsigned int (*requestClientVariables)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode);
85 | unsigned int (*requestClientKickFromChannel)(uint64 serverConnectionHandlerID, anyID clientID, const char* kickReason, const char* returnCode);
86 | unsigned int (*requestClientKickFromServer)(uint64 serverConnectionHandlerID, anyID clientID, const char* kickReason, const char* returnCode);
87 | unsigned int (*requestChannelDelete)(uint64 serverConnectionHandlerID, uint64 channelID, int force, const char* returnCode);
88 | unsigned int (*requestChannelMove)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID, uint64 newChannelOrder, const char* returnCode);
89 | unsigned int (*requestSendPrivateTextMsg)(uint64 serverConnectionHandlerID, const char* message, anyID targetClientID, const char* returnCode);
90 | unsigned int (*requestSendChannelTextMsg)(uint64 serverConnectionHandlerID, const char* message, uint64 targetChannelID, const char* returnCode);
91 | unsigned int (*requestSendServerTextMsg)(uint64 serverConnectionHandlerID, const char* message, const char* returnCode);
92 | unsigned int (*requestConnectionInfo)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode);
93 | unsigned int (*requestClientSetWhisperList)(uint64 serverConnectionHandlerID, anyID clientID, const uint64* targetChannelIDArray, const anyID* targetClientIDArray, const char* returnCode);
94 | unsigned int (*requestChannelSubscribe)(uint64 serverConnectionHandlerID, const uint64* channelIDArray, const char* returnCode);
95 | unsigned int (*requestChannelSubscribeAll)(uint64 serverConnectionHandlerID, const char* returnCode);
96 | unsigned int (*requestChannelUnsubscribe)(uint64 serverConnectionHandlerID, const uint64* channelIDArray, const char* returnCode);
97 | unsigned int (*requestChannelUnsubscribeAll)(uint64 serverConnectionHandlerID, const char* returnCode);
98 | unsigned int (*requestChannelDescription)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode);
99 | unsigned int (*requestMuteClients)(uint64 serverConnectionHandlerID, const anyID* clientIDArray, const char* returnCode);
100 | unsigned int (*requestUnmuteClients)(uint64 serverConnectionHandlerID, const anyID* clientIDArray, const char* returnCode);
101 | unsigned int (*requestClientPoke)(uint64 serverConnectionHandlerID, anyID clientID, const char* message, const char* returnCode);
102 | unsigned int (*requestClientIDs)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode);
103 | unsigned int (*clientChatClosed)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, anyID clientID, const char* returnCode);
104 | unsigned int (*clientChatComposing)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode);
105 | unsigned int (*requestServerTemporaryPasswordAdd)(uint64 serverConnectionHandlerID, const char* password, const char* description, uint64 duration, uint64 targetChannelID, const char* targetChannelPW, const char* returnCode);
106 | unsigned int (*requestServerTemporaryPasswordDel)(uint64 serverConnectionHandlerID, const char* password, const char* returnCode);
107 | unsigned int (*requestServerTemporaryPasswordList)(uint64 serverConnectionHandlerID, const char* returnCode);
108 |
109 | /* Access clientlib information */
110 |
111 | /* Query own client ID */
112 | unsigned int (*getClientID)(uint64 serverConnectionHandlerID, anyID* result);
113 |
114 | /* Client info */
115 | unsigned int (*getClientSelfVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int* result);
116 | unsigned int (*getClientSelfVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, char** result);
117 | unsigned int (*setClientSelfVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int value);
118 | unsigned int (*setClientSelfVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, const char* value);
119 | unsigned int (*flushClientSelfUpdates)(uint64 serverConnectionHandlerID, const char* returnCode);
120 | unsigned int (*getClientVariableAsInt)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, int* result);
121 | unsigned int (*getClientVariableAsUInt64)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, uint64* result);
122 | unsigned int (*getClientVariableAsString)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, char** result);
123 | unsigned int (*getClientList)(uint64 serverConnectionHandlerID, anyID** result);
124 | unsigned int (*getChannelOfClient)(uint64 serverConnectionHandlerID, anyID clientID, uint64* result);
125 |
126 | /* Channel info */
127 | unsigned int (*getChannelVariableAsInt)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, int* result);
128 | unsigned int (*getChannelVariableAsUInt64)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, uint64* result);
129 | unsigned int (*getChannelVariableAsString)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, char** result);
130 | unsigned int (*getChannelIDFromChannelNames)(uint64 serverConnectionHandlerID, char** channelNameArray, uint64* result);
131 | unsigned int (*setChannelVariableAsInt)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, int value);
132 | unsigned int (*setChannelVariableAsUInt64)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, uint64 value);
133 | unsigned int (*setChannelVariableAsString)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, const char* value);
134 | unsigned int (*flushChannelUpdates)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode);
135 | unsigned int (*flushChannelCreation)(uint64 serverConnectionHandlerID, uint64 channelParentID, const char* returnCode);
136 | unsigned int (*getChannelList)(uint64 serverConnectionHandlerID, uint64** result);
137 | unsigned int (*getChannelClientList)(uint64 serverConnectionHandlerID, uint64 channelID, anyID** result);
138 | unsigned int (*getParentChannelOfChannel)(uint64 serverConnectionHandlerID, uint64 channelID, uint64* result);
139 |
140 | /* Server info */
141 | unsigned int (*getServerConnectionHandlerList)(uint64** result);
142 | unsigned int (*getServerVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int* result);
143 | unsigned int (*getServerVariableAsUInt64)(uint64 serverConnectionHandlerID, size_t flag, uint64* result);
144 | unsigned int (*getServerVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, char** result);
145 | unsigned int (*requestServerVariables)(uint64 serverConnectionHandlerID);
146 |
147 | /* Connection info */
148 | unsigned int (*getConnectionStatus)(uint64 serverConnectionHandlerID, int* result);
149 | unsigned int (*getConnectionVariableAsUInt64)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, uint64* result);
150 | unsigned int (*getConnectionVariableAsDouble)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, double* result);
151 | unsigned int (*getConnectionVariableAsString)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, char** result);
152 | unsigned int (*cleanUpConnectionInfo)(uint64 serverConnectionHandlerID, anyID clientID);
153 |
154 | /* Client related */
155 | unsigned int (*requestClientDBIDfromUID)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode);
156 | unsigned int (*requestClientNamefromUID)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode);
157 | unsigned int (*requestClientNamefromDBID)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode);
158 | unsigned int (*requestClientEditDescription)(uint64 serverConnectionHandlerID, anyID clientID, const char* clientDescription, const char* returnCode);
159 | unsigned int (*requestClientSetIsTalker)(uint64 serverConnectionHandlerID, anyID clientID, int isTalker, const char* returnCode);
160 | unsigned int (*requestIsTalker)(uint64 serverConnectionHandlerID, int isTalkerRequest, const char* isTalkerRequestMessage, const char* returnCode);
161 |
162 | /* Plugin related */
163 | unsigned int (*requestSendClientQueryCommand)(uint64 serverConnectionHandlerID, const char* command, const char* returnCode);
164 |
165 | /* Filetransfer */
166 | unsigned int (*getTransferFileName)(anyID transferID, char** result);
167 | unsigned int (*getTransferFilePath)(anyID transferID, char** result);
168 | unsigned int (*getTransferFileSize)(anyID transferID, uint64* result);
169 | unsigned int (*getTransferFileSizeDone)(anyID transferID, uint64* result);
170 | unsigned int (*isTransferSender)(anyID transferID, int* result); /* 1 == upload, 0 == download */
171 | unsigned int (*getTransferStatus)(anyID transferID, int* result);
172 | unsigned int (*getCurrentTransferSpeed)(anyID transferID, float* result);
173 | unsigned int (*getAverageTransferSpeed)(anyID transferID, float* result);
174 | unsigned int (*getTransferRunTime)(anyID transferID, uint64* result);
175 | unsigned int (*sendFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, int overwrite, int resume, const char* sourceDirectory, anyID* result, const char* returnCode);
176 | unsigned int (*requestFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, int overwrite, int resume, const char* destinationDirectory, anyID* result, const char* returnCode);
177 | unsigned int (*haltTransfer)(uint64 serverConnectionHandlerID, anyID transferID, int deleteUnfinishedFile, const char* returnCode);
178 | unsigned int (*requestFileList)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* path, const char* returnCode);
179 | unsigned int (*requestFileInfo)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, const char* returnCode);
180 | unsigned int (*requestDeleteFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char** file, const char* returnCode);
181 | unsigned int (*requestCreateDirectory)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* directoryPath, const char* returnCode);
182 | unsigned int (*requestRenameFile)(uint64 serverConnectionHandlerID, uint64 fromChannelID, const char* channelPW, uint64 toChannelID, const char* toChannelPW, const char* oldFile, const char* newFile, const char* returnCode);
183 |
184 | /* Offline message management */
185 | unsigned int (*requestMessageAdd)(uint64 serverConnectionHandlerID, const char* toClientUID, const char* subject, const char* message, const char* returnCode);
186 | unsigned int (*requestMessageDel)(uint64 serverConnectionHandlerID, uint64 messageID, const char* returnCode);
187 | unsigned int (*requestMessageGet)(uint64 serverConnectionHandlerID, uint64 messageID, const char* returnCode);
188 | unsigned int (*requestMessageList)(uint64 serverConnectionHandlerID, const char* returnCode);
189 | unsigned int (*requestMessageUpdateFlag)(uint64 serverConnectionHandlerID, uint64 messageID, int flag, const char* returnCode);
190 |
191 | /* Interacting with the server - confirming passwords */
192 | unsigned int (*verifyServerPassword)(uint64 serverConnectionHandlerID, const char* serverPassword, const char* returnCode);
193 | unsigned int (*verifyChannelPassword)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPassword, const char* returnCode);
194 |
195 | /* Interacting with the server - banning */
196 | unsigned int (*banclient)(uint64 serverConnectionHandlerID, anyID clientID, uint64 timeInSeconds, const char* banReason, const char* returnCode);
197 | unsigned int (*banadd)(uint64 serverConnectionHandlerID, const char* ipRegExp, const char* nameRegexp, const char* uniqueIdentity, const char* mytsID, uint64 timeInSeconds, const char* banReason, const char* returnCode);
198 | unsigned int (*banclientdbid)(uint64 serverConnectionHandlerID, uint64 clientDBID, uint64 timeInSeconds, const char* banReason, const char* returnCode);
199 | unsigned int (*bandel)(uint64 serverConnectionHandlerID, uint64 banID, const char* returnCode);
200 | unsigned int (*bandelall)(uint64 serverConnectionHandlerID, const char* returnCode);
201 | unsigned int (*requestBanList)(uint64 serverConnectionHandlerID, uint64 start, unsigned int duration, const char* returnCode);
202 |
203 | /* Interacting with the server - complain */
204 | unsigned int (*requestComplainAdd)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* complainReason, const char* returnCode);
205 | unsigned int (*requestComplainDel)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, uint64 fromClientDatabaseID, const char* returnCode);
206 | unsigned int (*requestComplainDelAll)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* returnCode);
207 | unsigned int (*requestComplainList)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* returnCode);
208 |
209 | /* Permissions */
210 | unsigned int (*requestServerGroupList)(uint64 serverConnectionHandlerID, const char* returnCode);
211 | unsigned int (*requestServerGroupAdd)(uint64 serverConnectionHandlerID, const char* groupName, int groupType, const char* returnCode);
212 | unsigned int (*requestServerGroupDel)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int force, const char* returnCode);
213 | unsigned int (*requestServerGroupAddClient)(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* returnCode);
214 | unsigned int (*requestServerGroupDelClient)(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* returnCode);
215 | unsigned int (*requestServerGroupsByClientID)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode);
216 | unsigned int (*requestServerGroupAddPerm)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int continueonerror, const unsigned int* permissionIDArray, const int* permissionValueArray, const int* permissionNegatedArray, const int* permissionSkipArray, int arraySize, const char* returnCode);
217 | unsigned int (*requestServerGroupDelPerm)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int continueOnError, const unsigned int* permissionIDArray, int arraySize, const char* returnCode);
218 | unsigned int (*requestServerGroupPermList)(uint64 serverConnectionHandlerID, uint64 serverGroupID, const char* returnCode);
219 | unsigned int (*requestServerGroupClientList)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int withNames, const char* returnCode);
220 | unsigned int (*requestChannelGroupList)(uint64 serverConnectionHandlerID, const char* returnCode);
221 | unsigned int (*requestChannelGroupAdd)(uint64 serverConnectionHandlerID, const char* groupName, int groupType, const char* returnCode);
222 | unsigned int (*requestChannelGroupDel)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int force, const char* returnCode);
223 | unsigned int (*requestChannelGroupAddPerm)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int continueonerror, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode);
224 | unsigned int (*requestChannelGroupDelPerm)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int continueOnError, const unsigned int* permissionIDArray, int arraySize, const char* returnCode);
225 | unsigned int (*requestChannelGroupPermList)(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char* returnCode);
226 | unsigned int (*requestSetClientChannelGroup)(uint64 serverConnectionHandlerID, const uint64* channelGroupIDArray, const uint64* channelIDArray, const uint64* clientDatabaseIDArray, int arraySize, const char* returnCode);
227 | unsigned int (*requestChannelAddPerm)(uint64 serverConnectionHandlerID, uint64 channelID, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode);
228 | unsigned int (*requestChannelDelPerm)(uint64 serverConnectionHandlerID, uint64 channelID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode);
229 | unsigned int (*requestChannelPermList)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode);
230 | unsigned int (*requestClientAddPerm)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, const int* permissionValueArray, const int* permissionSkipArray, int arraySize, const char* returnCode);
231 | unsigned int (*requestClientDelPerm)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode);
232 | unsigned int (*requestClientPermList)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode);
233 | unsigned int (*requestChannelClientAddPerm)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode);
234 | unsigned int (*requestChannelClientDelPerm)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode);
235 | unsigned int (*requestChannelClientPermList)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const char* returnCode);
236 | unsigned int (*privilegeKeyUse)(uint64 serverConnectionHandler, const char* tokenKey, const char* returnCode);
237 | unsigned int (*requestPermissionList)(uint64 serverConnectionHandler, const char* returnCode);
238 | unsigned int (*requestPermissionOverview)(uint64 serverConnectionHandler, uint64 clientDBID, uint64 channelID, const char* returnCode);
239 |
240 | /* Helper Functions */
241 | unsigned int (*clientPropertyStringToFlag)(const char* clientPropertyString, size_t* resultFlag);
242 | unsigned int (*channelPropertyStringToFlag)(const char* channelPropertyString, size_t* resultFlag);
243 | unsigned int (*serverPropertyStringToFlag)(const char* serverPropertyString, size_t* resultFlag);
244 |
245 | /* Client functions */
246 | void (*getAppPath)(char* path, size_t maxLen);
247 | void (*getResourcesPath)(char* path, size_t maxLen);
248 | void (*getConfigPath)(char* path, size_t maxLen);
249 | void (*getPluginPath)(char* path, size_t maxLen, const char* pluginID);
250 | uint64 (*getCurrentServerConnectionHandlerID)();
251 | void (*printMessage)(uint64 serverConnectionHandlerID, const char* message, enum PluginMessageTarget messageTarget);
252 | void (*printMessageToCurrentTab)(const char* message);
253 | void (*urlsToBB)(const char* text, char* result, size_t maxLen);
254 | void (*sendPluginCommand)(uint64 serverConnectionHandlerID, const char* pluginID, const char* command, int targetMode, const anyID* targetIDs, const char* returnCode);
255 | void (*getDirectories)(const char* path, char* result, size_t maxLen);
256 | unsigned int (*getServerConnectInfo)(uint64 scHandlerID, char* host, unsigned short* port, char* password, size_t maxLen);
257 | unsigned int (*getChannelConnectInfo)(uint64 scHandlerID, uint64 channelID, char* path, char* password, size_t maxLen);
258 | void (*createReturnCode)(const char* pluginID, char* returnCode, size_t maxLen);
259 | unsigned int (*requestInfoUpdate)(uint64 scHandlerID, enum PluginItemType itemType, uint64 itemID);
260 | uint64 (*getServerVersion)(uint64 scHandlerID);
261 | unsigned int (*isWhispering)(uint64 scHandlerID, anyID clientID, int* result);
262 | unsigned int (*isReceivingWhisper)(uint64 scHandlerID, anyID clientID, int* result);
263 | unsigned int (*getAvatar)(uint64 scHandlerID, anyID clientID, char* result, size_t maxLen);
264 | void (*setPluginMenuEnabled)(const char* pluginID, int menuID, int enabled);
265 | void (*showHotkeySetup)();
266 | void (*requestHotkeyInputDialog)(const char* pluginID, const char* keyword, int isDown, void* qParentWindow);
267 | unsigned int (*getHotkeyFromKeyword)(const char* pluginID, const char** keywords, char** hotkeys, size_t arrayLen, size_t hotkeyBufSize);
268 | unsigned int (*getClientDisplayName)(uint64 scHandlerID, anyID clientID, char* result, size_t maxLen);
269 | unsigned int (*getBookmarkList)(struct PluginBookmarkList** list);
270 | unsigned int (*getProfileList)(enum PluginGuiProfile profile, int* defaultProfileIdx, char*** result);
271 | unsigned int (*guiConnect)(enum PluginConnectTab connectTab, const char* serverLabel, const char* serverAddress, const char* serverPassword, const char* nickname, const char* channel, const char* channelPassword, const char* captureProfile, const char* playbackProfile, const char* hotkeyProfile, const char* soundProfile, const char* userIdentity, const char* oneTimeKey, const char* phoneticName, uint64* scHandlerID);
272 | unsigned int (*guiConnectBookmark)(enum PluginConnectTab connectTab, const char* bookmarkuuid, uint64* scHandlerID);
273 | unsigned int (*createBookmark)(const char* bookmarkuuid, const char* serverLabel, const char* serverAddress, const char* serverPassword, const char* nickname, const char* channel, const char* channelPassword, const char* captureProfile, const char* playbackProfile, const char* hotkeyProfile, const char* soundProfile, const char* uniqueUserId, const char* oneTimeKey, const char* phoneticName);
274 | unsigned int (*getPermissionIDByName)(uint64 serverConnectionHandlerID, const char* permissionName, unsigned int* result);
275 | unsigned int (*getClientNeededPermission)(uint64 serverConnectionHandlerID, const char* permissionName, int* result);
276 | void(*notifyKeyEvent)(const char *pluginID, const char *keyIdentifier, int up_down);
277 | };
278 |
279 | #ifdef __cplusplus
280 | }
281 | #endif
282 |
283 | #endif
284 |
--------------------------------------------------------------------------------
/TS3Hook/main.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #ifndef MAIN_H
7 | #define MAIN_H
8 | #include
9 | #include "include/ts3_functions.h"
10 |
11 | #if _WIN32 || _WIN64
12 | #if _WIN64
13 | #define ENV64
14 | #else
15 | #define ENV32
16 | #endif
17 | #endif
18 |
19 | // Check GCC
20 | #if __GNUC__
21 | #if __x86_64__ || __ppc64__
22 | #define ENV64
23 | #else
24 | #define ENV32
25 | #endif
26 | #endif
27 |
28 | // FUNCTION DECLS
29 | bool core_hook();
30 | bool try_hook();
31 | void idle_loop();
32 | void read_config();
33 |
34 | #ifdef ENV32
35 | #define MOD (L"ts3client_win32.exe")
36 | #else
37 | #define MOD (L"ts3client_win64.exe")
38 | #endif
39 |
40 | extern "C"
41 | {
42 | void log_in_packet(char* packet, int length);
43 | void log_out_packet(char* packet, int length);
44 |
45 | void packet_in_hook1();
46 | void packet_out_hook1();
47 | #ifdef ENV64
48 | void packet_in_hook2();
49 | void packet_out_hook2();
50 | void packet_out_hook3();
51 | void packet_out_hook4();
52 | #endif
53 | }
54 |
55 | const struct hookpt
56 | {
57 | const SIZE_T hook_return_offset;
58 | const SIZE_T hook_length;
59 | void (*target_hook)();
60 | const char* PATT;
61 | const char* MASK;
62 | };
63 |
64 | #define PLUGINS_EXPORTDLL __declspec(dllexport)
65 |
66 | // Plugin exports
67 | extern "C" {
68 | /* Required functions */
69 | PLUGINS_EXPORTDLL const char* ts3plugin_name();
70 | PLUGINS_EXPORTDLL const char* ts3plugin_version();
71 | PLUGINS_EXPORTDLL int ts3plugin_apiVersion();
72 | PLUGINS_EXPORTDLL const char* ts3plugin_author();
73 | PLUGINS_EXPORTDLL const char* ts3plugin_description();
74 | PLUGINS_EXPORTDLL int ts3plugin_init();
75 | PLUGINS_EXPORTDLL void ts3plugin_shutdown();
76 | PLUGINS_EXPORTDLL void ts3plugin_setFunctionPointers(const struct TS3Functions funcs);
77 | PLUGINS_EXPORTDLL void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber);
78 | PLUGINS_EXPORTDLL int ts3plugin_onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, const char* extraMessage);
79 | }
80 |
81 | #endif // MAIN_H
82 |
--------------------------------------------------------------------------------
/TS3Hook/util.cpp:
--------------------------------------------------------------------------------
1 | #include "util.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | char const hex_chars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
8 |
9 | void print_hex(const char* data, const int len)
10 | {
11 | const char* p = data;
12 | for (int i = 0; i < len; p++, i++)
13 | {
14 | printf("%c%c ", hex_chars[(*p & 0xF0) >> 4], hex_chars[(*p & 0x0F) >> 0]);
15 | }
16 | }
17 |
18 | std::string random_string(size_t length)
19 | {
20 | const auto randchar = []() -> char
21 | {
22 | const char charset[] =
23 | "0123456789"
24 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
25 | "abcdefghijklmnopqrstuvwxyz";
26 | const size_t max_index = (sizeof(charset) - 1);
27 | return charset[rand() % max_index];
28 | };
29 | std::string str(length, 0);
30 | std::generate_n(str.begin(), length, randchar);
31 | return str;
32 | }
33 |
34 | // (start, length)
35 | std::tuple find_param(std::string str, const char* ptr)
36 | {
37 | const auto start = str.find(ptr) + strlen(ptr);
38 | const auto end = str.find(" ", start);
39 | if (end == std::string::npos)
40 | return std::make_tuple(start, str.length() - start);
41 | else
42 | return std::make_tuple(start, end - start);
43 | }
--------------------------------------------------------------------------------
/TS3Hook/util.h:
--------------------------------------------------------------------------------
1 | #ifndef UTIL_H
2 | #define UTIL_H
3 | #include
4 | #include
5 |
6 | void print_hex(const char* data, const int len);
7 | std::string random_string(size_t length);
8 | std::tuple find_param(std::string str, const char* ptr);
9 |
10 | #endif // UTIL_H
11 |
--------------------------------------------------------------------------------