Improve Live Game Scanner
Live Game Scanner is too slow and unreliable at times. Procmon is not only way faster in getting file paths but can also get the obscure ones. The only issue is that It might also grab stuff unrelated to a map as well. You just need to filter the results given from the program.
Link to tool: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon How it can be used: https://web.archive.org/web/20231201201948/https://www.hiveworkshop.com/threads/poc-reforged-mpq-name-scanner.351760/
I believe this is exactly what I'm doing except instead of using ProcMon as an external app, I re-coded it directly inside WC3MapDeprotector.
I'm using WC3's "Allow local files" registry setting. I'm using this API from Microsoft for monitoring hard drive access: Microsoft.Diagnostics.Tracing.Session.TraceEventSession
I'd love to improve it if it's not working correctly or if there's a better way.
Can you give me an example of a map & unknown file that can be discovered via procmon & https://web.archive.org/web/20231201201948/https://www.hiveworkshop.com/threads/poc-reforged-mpq-name-scanner.351760 which is not found by "Live Game Scanner" of WC3MapDeprotector? Also, tell me if there's something specific I need to click inside the map to get the unknown file to load from disk. (Select a unit, enter a dungeon, etc)
Having this example would help me troubleshoot why WC3MapDeprotector is failing to discover the unknown file.
It is not really an issue with certain maps. It is just that Live Game Scanner is incredibly slow in general. I could be playing around for hours on end just to get the path for a file. With ProcMon, you just need to run the map in game, and it will fetch the paths for a whole bunch of files without doing much of anything. You don't even need to play the game really. That is why I think you should integrate a tool like ProcMon and then strip the results it gives.
I understand exactly what you're saying. however, I need proof so I can fix it.
Live game scanner in my app already does use the same technology as procmon. It should produce the same result.
The reason live game scanner is slow & rarely finds files is because it's the last step of the deprotector and most files have already been discovered. For example, in a theoretical map maybe there are 1000 files, 990 are discovered by deprotector before live scanner, the last 10 are never found even by live scanner because they're probably not used. Procmon would also find 990 and not find the last 10.
Can you give me proof of 1 unknown file that is found by procmon but is unknown by my tool? I need this to help me research how to fix the bug because they should be the same.
I've added a feature to automatically load the deprotected map in the world editor at the end of processing. I'm going to attempt to do live scanning on it the same as in game (not sure if it uses the "Local Files" setting, I'll have to test).
In addition, I had an idea that I can search all other maps that use the same file by searching with the asset scanner tool from hive workshop https://www.hiveworkshop.com/asset-scanner
It searches based on the binary data in the file, rather than the filename, so it should find all references to it (assuming the map has been uploaded to hive).
If other map makers kept the same filename, we could deprotect the other map in hopes to discover the name. The manual process would be to deprotect the other maps in hopes the filename is found & added to the global list file, then deprotecting the 1st map again. I may be able to find a way to automate this a bit more.
Todo: Read all file names from all native blizzard MPQ files and add to global listfile. This is because custom maps can override base skins by re-using same filename as native, but no reference will be found by searching .mdx/.blp/etc of custom map because reference is in base game files. (will probably need a casc loader and if they're missing a listfile will need to run scanner against native game files)
Related issue: https://github.com/speige/WC3MapDeprotector/issues/42
Issue with live game scanning is any dynamically loaded jass assets won't be found unless you click the actually button in game to cause that portion of the script to run. Using https://github.com/speige/WC3GameDriver I can script the game to automatically execute every possible function, which will hopefully force the files to load. I'll need to wrap them each in a pcall to catch exceptions. I'll need to run them through https://github.com/speige/Jass2LuaTranspiler first because WC3GameDriver doesn't support jass maps.
Good example for testing: Zombie_Defense_0.24w_w3p_deprotected.w3x