Games using PubScale.SdkOne cause exceptions under some output formats
PubScale has a monetization SDK that is commonly used in Android games, however it seems to cause issues in Cpp2IL and other similar programs.
For Cpp2IL, it seems like it doesn't like how some of the classes are named, however most of them look fine to my eyes. These errors have been happening on new-analysis, the latest pre-release, and the latest workflow run.
A log with the errors is available here isil_dump.txt
The APK I tested with is available here com.survival.squid.impostor.apk
under some output formats
Which ones?
Anything that exports each class to it's own file, I used ISIL when testing.
So the dll and wasm output is fine? This is just for ISIL dump and diffable cs?
C:\Users\Trevor\Downloads>Cpp2IL.exe --game-path C:\Users\Trevor\Desktop\com.survival.squid.impostor.apk --output-as isil
===Cpp2IL by Samboy063===
A Tool to Reverse Unity's "il2cpp" Build Process.
Version 2022.1.0-development.1265+e93c0fe.e93c0fecc9d6c5afb6914acb278c8afaa8894cdd
[Info] [Program] Running on Win32NT
[Info] [Plugins] Loading plugins from C:\Users\Trevor\Downloads\Plugins...
[Info] [Plugins] Using Plugin: Cpp2IL Built-In
[Info] [APK] Attempting to extract required files from APK C:\Users\Trevor\Desktop\com.survival.squid.impostor.apk
[Info] [APK] Extracting APK/lib/arm64-v8a/libil2cpp.so to C:\Users\Trevor\AppData\Local\Temp\tmpi4ndrm.tmp
[Info] [APK] Extracting APK/assets/bin/Data/Managed/Metadata/global-metadata.dat to C:\Users\Trevor\AppData\Local\Temp\tmpfnbgcr.tmp
[Info] [APK] Reading globalgamemanagers to determine unity version...
[Info] [APK] Determined game's unity version to be 2022.3.22f1
[Info] [Library] Initializing Metadata...
[Info] [Library] Using actual IL2CPP Metadata version 29.1
[Info] [Library] Initialized Metadata in 269ms
[Info] [Library] Using binary type ELF (from LibCpp2IL)
[Info] [Library] Searching Binary for Required Data...
[Info] [Library] Got Binary codereg: 0x37040D8, metareg: 0x3821E38 in 720ms.
[Info] [Library] Initializing Binary...
[Info] [Library] Initialized Binary in 72ms
[Info] [Library] Mapping pointers to Il2CppMethodDefinitions...Processed 90625 OK (144ms)
[Info] [Program] Creating application model...
[Info] [Program] Application model created in 2061.9589ms
[Info] [Program] Pre-processing processing layers...
[Info] [Program] Invoking processing layers...
[Info] [Program] Outputting as ISIL Dump to C:\Users\Trevor\Downloads\cpp2il_out...
[Info] [IsilOutputFormat] Processing assembly 1 of 129: mscorlib
[Info] [IsilOutputFormat] Processing assembly 2 of 129: Assembly-CSharp
[Info] [IsilOutputFormat] Processing assembly 3 of 129: UnityEngine.UIElementsModule
[Info] [IsilOutputFormat] Processing assembly 4 of 129: System.Xml
[Info] [IsilOutputFormat] Processing assembly 5 of 129: System
[Info] [IsilOutputFormat] Processing assembly 6 of 129: Unity.RenderPipelines.Universal.Runtime
[Info] [IsilOutputFormat] Processing assembly 7 of 129: System.Data
[Info] [IsilOutputFormat] Processing assembly 8 of 129: UnityEngine.CoreModule
[Info] [IsilOutputFormat] Processing assembly 9 of 129: AstarPathfindingProject
[Info] [IsilOutputFormat] Processing assembly 10 of 129: Unity.RenderPipelines.Core.Runtime
[Info] [IsilOutputFormat] Processing assembly 11 of 129: System.Core
[Info] [IsilOutputFormat] Processing assembly 12 of 129: Newtonsoft.Json
[Info] [IsilOutputFormat] Processing assembly 13 of 129: Unity.TextMeshPro
[Info] [IsilOutputFormat] Processing assembly 14 of 129: spine-unity
[Info] [IsilOutputFormat] Processing assembly 15 of 129: UnityEngine.UI
[Info] [IsilOutputFormat] Processing assembly 16 of 129: PubScale.SdkOne
Unhandled exception. System.AggregateException: One or more errors occurred. (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\NativeAds\NativeAdDisplayHandler_NestedType.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\GGAdDownloader_NestedType_.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\PubScaleManager_NestedType_.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\OrtbDownloader_NestedType_.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\PubScaleSDK_NestedType.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\ReportingService_NestedType_.txt'.) (The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\S2SDownloader_NestedType_.txt'.)
---> System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of inner exception stack trace ---
at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
at System.Linq.Parallel.SpoolingTask.SpoolStopAndGo[TInputOutput,TIgnoreKey](QueryTaskGroupState groupState, PartitionedStream`2 partitions, SynchronousChannel`1[] channels, TaskScheduler taskScheduler)
at System.Linq.Parallel.DefaultMergeHelper`2.System.Linq.Parallel.IMergeHelper<TInputOutput>.Execute()
at System.Linq.Parallel.MergeExecutor`1.Execute()
at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2 partitionedStream)
at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
at System.Linq.Parallel.QueryOperator`1.GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
at System.Linq.Parallel.QueryOpeningEnumerator`1.OpenQuery()
at System.Linq.Parallel.QueryOpeningEnumerator`1.MoveNext()
at System.Linq.ParallelEnumerable.ToList[TSource](ParallelQuery`1 source)
at Cpp2IL.Core.Utils.MiscUtils.ExecuteParallel[T](IEnumerable`1 enumerable, Action`1 what) in /_/Cpp2IL.Core/Utils/MiscUtils.cs:line 257
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.DoOutput(ApplicationAnalysisContext context, String outputRoot) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 31
at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs) in /home/runner/work/Cpp2IL/Cpp2IL/Cpp2IL/Program.cs:line 705
at Cpp2IL.Program.Main(String[] args) in /home/runner/work/Cpp2IL/Cpp2IL/Cpp2IL/Program.cs:line 617
---> (Inner Exception #1) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #2) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\NativeAds\NativeAdDisplayHandler_NestedType.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #3) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\GGAdDownloader_NestedType_.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #4) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\PubScaleManager_NestedType_.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #5) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\OrtbDownloader_NestedType_.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #6) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\PubScaleSDK_NestedType.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #7) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #8) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\ReportingService_NestedType_.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
---> (Inner Exception #9) System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\Trevor\Downloads\cpp2il_out\IsilDump\PubScale.SdkOne\PubScale\SdkOne\S2SDownloader_NestedType_.txt'.
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.WriteToFile(String path, FileMode mode, ReadOnlySpan`1 contents, Encoding encoding)
at Cpp2IL.Core.OutputFormats.IsilDumpOutputFormat.<>c__DisplayClass4_1.<DoOutput>b__0(TypeAnalysisContext type) in /_/Cpp2IL.Core/OutputFormats/IsilDumpOutputFormat.cs:line 33
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)<---
Correct. Looking closer it seems like the DLLs have some obfuscation likely causing the problems.
The stacktrace is in the log I attached.
The best way to handle this would probably be to escape new lines and control characters in the path. I believe ILSpy uses an underscore followed by 4 hex digits.