• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Using Storm.dll

Status
Not open for further replies.
Level 5
Joined
May 6, 2013
Messages
125
At first, sorry if I'm wrong here. I couldn't really find a sub-forum that fits better.

Well, I'm currently working on an assembly injection to the world editor. It hooks into the save routine of the WE and skips the generation of certain files (war3map.doo etc) if no changes have been made that would alter this file. Instead, it looks into the opened map archive and copies the existing file from there. (It's actually saving me a lot of time already with my 8000 tree monster map)

Now, since this is a direct injection into the world editor, which has storm.dll loaded allready and successfully uses it to read from and write new maps, i thought i might as well use it.

However, i have found no real documentation of this library telling me how to use it to extract files from an archive. So i looked into the world editor trying to find out how IT reads from the archives, and it turned out to use Storm.Ordinal279, which, according to the internet, looks like this:

int __stdcall SFileLoadFile(char *filename, int a2, int a3, int a4, int a5)

Observing a few calls, i can now tell that
-a2 is a pointer to a pointer that will point to the buffer received
-a3 is a pointer to a DWORD that will contain the size of that buffer
-a4 and a5 are flags

Attentive Readers will have noticed that the function doesn't even take an archive as a parameter, just the file name of the file to be extracted. Calling it, it actually extracts from the correct archive, but only god (and blizzard) knows how and why.

So im dragging my paranoid body to this website constantly fearing that it extracts a file from some other random archive to get an answer to this weird question:
How does he know from which archive he should extract the files? Will it always be the correct file? Is it possible to actually tell Storm.dll from which archive i want to extract my files from?

TLDR: how the heck do i use Storm.dll?
 
Level 5
Joined
May 6, 2013
Messages
125
I am guessing Storm.dll operates as a state machine

I guess you are right. It seems that those functions use a pointer located at Storm.dll+49610 that points to a unknown struct which contains the file path to the archive he is extracting from. It is accessed by the Load-Functions and set when calling OpenArchive, CloseArchive or SetFilePointer (wtf?)

As for the StormLib: The Page that Hell Master linked actually contained an example for the usage of StormLib, which seemingly is capable of importing functions from the Storm.dll. I used the functions (OpenArchive, OpenFileEx, ReadFile, CloseFile and CloseArchive), and it actually WORKED. Big thx for this one.
The only thing that bugs me about this solution is that the OpenFileEx and CloseFile functions do not have an entry in the world editors import table for Storm.dll, probably because they are not meant to be called directly. It seems weird, but because i use cheat engine anways, it's not gonna become a problem i guess.

: Also, would you be interested in distributing that tool? It seems really neat. :)

- Providing a useful GUI and making it independent of Cheat Engine will probably be a whole lot of work,
- not to mention that i'm only like 50% through with it at this point. The World Editor even once decided to erase my whole Warcraft 3 folder for some ****ed up weird reason, and i'd feel guilty if that happened to anybody else
- I would need to find the Module Adresses. You need some weird library to do this (namely the TlHelp32.h file), and due to its limited use aside from hacking things, AntiVir constantly 'Warns' the steaming pile of warm brown matter out of me, and not only out of me, but out of everybody who would ever get to see this executable; and Virus Warnings are nothing fun
- I highly doubt it would be compatible to the New Gen Pack, as i'm pretty sure that it allready hooks half of those functions itself and shifts around variables of some sort.
 
Status
Not open for further replies.
Top