From 8e053ff5334f8aafaa8e5cc449fd90a71866b0a6 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sat, 12 Feb 2022 13:14:12 +0100 Subject: Updated test project for storm.dll --- storm_dll/Storm_dll.sln | 35 ---- storm_dll/Storm_dll.vcproj | 363 ----------------------------------- storm_dll/storm.cpp | 117 +++++++++++ storm_dll/storm.def | 25 +++ storm_dll/storm.h | 65 +++++++ storm_dll/storm.lib | Bin 5238 -> 0 bytes storm_dll/storm.vcxproj | 197 +++++++++++++++++++ storm_dll/storm.vcxproj.filters | 28 +++ storm_dll/storm_dll.cpp | 117 ----------- storm_dll/storm_dll.def | 25 --- storm_dll/storm_dll.h | 65 ------- storm_dll/storm_test.cpp | 45 ++++- storm_dll/storm_test.vcxproj | 202 +++++++++++++++++++ storm_dll/storm_test.vcxproj.filters | 22 +++ storm_dll/storm_test_vs08.vcproj | 359 ---------------------------------- storm_dll/storm_vs19.sln | 43 +++++ test/StormTest.cpp | 2 +- 17 files changed, 739 insertions(+), 971 deletions(-) delete mode 100644 storm_dll/Storm_dll.sln delete mode 100644 storm_dll/Storm_dll.vcproj create mode 100644 storm_dll/storm.cpp create mode 100644 storm_dll/storm.def create mode 100644 storm_dll/storm.h delete mode 100644 storm_dll/storm.lib create mode 100644 storm_dll/storm.vcxproj create mode 100644 storm_dll/storm.vcxproj.filters delete mode 100644 storm_dll/storm_dll.cpp delete mode 100644 storm_dll/storm_dll.def delete mode 100644 storm_dll/storm_dll.h create mode 100644 storm_dll/storm_test.vcxproj create mode 100644 storm_dll/storm_test.vcxproj.filters delete mode 100644 storm_dll/storm_test_vs08.vcproj create mode 100644 storm_dll/storm_vs19.sln diff --git a/storm_dll/Storm_dll.sln b/storm_dll/Storm_dll.sln deleted file mode 100644 index 286e613..0000000 --- a/storm_dll/Storm_dll.sln +++ /dev/null @@ -1,35 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storm_dll", "storm_dll.vcproj", "{BD600973-C6FA-4CE3-8821-67F6418B7F9C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storm_test", "storm_test_vs08.vcproj", "{5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|Win32.Build.0 = Debug|Win32 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|x64.ActiveCfg = Debug|x64 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|x64.Build.0 = Debug|x64 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|Win32.ActiveCfg = Release|Win32 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|Win32.Build.0 = Release|Win32 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|x64.ActiveCfg = Release|x64 - {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|x64.Build.0 = Release|x64 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|Win32.ActiveCfg = Debug|Win32 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|Win32.Build.0 = Debug|Win32 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|x64.ActiveCfg = Debug|x64 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|x64.Build.0 = Debug|x64 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|Win32.ActiveCfg = Release|Win32 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|Win32.Build.0 = Release|Win32 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|x64.ActiveCfg = Release|x64 - {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/storm_dll/Storm_dll.vcproj b/storm_dll/Storm_dll.vcproj deleted file mode 100644 index 6b123ff..0000000 --- a/storm_dll/Storm_dll.vcproj +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/storm_dll/storm.cpp b/storm_dll/storm.cpp new file mode 100644 index 0000000..814f7c8 --- /dev/null +++ b/storm_dll/storm.cpp @@ -0,0 +1,117 @@ +/*****************************************************************************/ +/* Storm.cpp Copyright (c) Ladislav Zezula 2003 */ +/*---------------------------------------------------------------------------*/ +/* This is just a dummy module for building import library for Storm.dll */ +/*---------------------------------------------------------------------------*/ +/* Date Ver Who Comment */ +/* -------- ---- --- ------- */ +/* 11.04.03 1.00 Lad The first version of Storm.cpp */ +/*****************************************************************************/ + +#include + +#define BUILDING_STORM_CPP +#define STORM_ALTERNATE_NAMES +#include "storm.h" + +BOOL WINAPI SFILE(OpenArchive)(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, HANDLE *hMPQ) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(CloseArchive)(HANDLE hMPQ) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(GetArchiveName)(HANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(OpenFile)(LPCSTR lpFileName, HANDLE *hFile) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(OpenFileEx)(HANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, HANDLE *hFile) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(CloseFile)(HANDLE hFile) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +DWORD WINAPI SFILE(GetFileSize)(HANDLE hFile, LPDWORD lpFileSizeHigh) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(GetFileArchive)(HANDLE hFile, HANDLE *hMPQ) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(GetFileName)(HANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +DWORD WINAPI SFILE(SetFilePointer)(HANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(ReadFile)(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +LCID WINAPI SFILE(SetLocale)(LCID nNewLocale) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(GetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(SetBasePath)(LPCSTR lpNewBasePath) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SFILE(Destroy)() +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SCOMP(Compress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength, int uCmp, int uCmpType, int nCmpLevel) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SCOMP(Decompress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} diff --git a/storm_dll/storm.def b/storm_dll/storm.def new file mode 100644 index 0000000..8de88f5 --- /dev/null +++ b/storm_dll/storm.def @@ -0,0 +1,25 @@ +; Storm definition file with alternate Storm.dll names +LIBRARY "Storm" + +EXPORTS + StormCloseArchive @252 ; 0x0FC + StormCloseFile @253 ; 0x0FD + StormDestroy @262 ; 0x106 + StormGetFileArchive @264 ; 0x108 + StormGetFileSize @265 ; 0x109 + StormOpenArchive @266 ; 0x10A + StormOpenFile @267 ; 0x10B + StormOpenFileEx @268 ; 0x10C + StormReadFile @269 ; 0x10D + StormSetBasePath @270 ; 0x10E + StormSetFilePointer @271 ; 0x10F + StormSetLocale @272 ; 0x110 + StormGetBasePath @273 ; 0x111 + StormGetArchiveName @275 ; 0x113 + StormGetFileName @276 ; 0x114 + +; StormSetLastError @465 ; 0x + + StormCompress @551 ; 0x227 + StormDecompress @552 ; 0x228 + \ No newline at end of file diff --git a/storm_dll/storm.h b/storm_dll/storm.h new file mode 100644 index 0000000..75681b8 --- /dev/null +++ b/storm_dll/storm.h @@ -0,0 +1,65 @@ +/*****************************************************************************/ +/* Storm.h Copyright Justin Olbrantz(Quantam) 2000 */ +/*---------------------------------------------------------------------------*/ +/* Storm Interface Library v1.0 for Windows */ +/* */ +/* Author : Justin Olbrantz(Quantam) */ +/* E-mail : omega@dragonfire.net */ +/* WWW : www.campaigncreations.com/starcraft/mpq2k/inside_mopaq/ */ +/*---------------------------------------------------------------------------*/ +/* Date Ver Who Comment */ +/* -------- ---- --- ------- */ +/* xx.xx.00 1.00 Qua The first version of Storm.h */ +/* 11.04.03 1.00 Lad Added some functions */ +/*****************************************************************************/ + +#ifndef __STORM_H__ +#define __STORM_H__ + +// We need the Windows data types for the Storm prototypes +#include + +// Sometimes is necessary to change the function names so they +// will not conflict with other MPQ tools. +#ifdef STORM_ALTERNATE_NAMES + #define SFILE(Name) Storm##Name + #define SCOMP(Name) Storm##Name +#else + #define SFILE(Name) SFile##Name + #define SCOMP(Name) SComp##Name +#endif + +// Make sure the functions are exported as C functions +#ifdef __cplusplus +extern "C" { +#endif + +// Storm file function prototypes +BOOL WINAPI SFILE(OpenArchive)(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, HANDLE *hMPQ); +BOOL WINAPI SFILE(CloseArchive)(HANDLE hMPQ); +BOOL WINAPI SFILE(GetArchiveName)(HANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength); +BOOL WINAPI SFILE(OpenFile)(LPCSTR lpFileName, HANDLE *hFile); +BOOL WINAPI SFILE(OpenFileEx)(HANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, HANDLE *hFile); +BOOL WINAPI SFILE(CloseFile)(HANDLE hFile); +DWORD WINAPI SFILE(GetFileSize)(HANDLE hFile, LPDWORD lpFileSizeHigh); +BOOL WINAPI SFILE(GetFileArchive)(HANDLE hFile, HANDLE *hMPQ); +BOOL WINAPI SFILE(GetFileName)(HANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength); +DWORD WINAPI SFILE(SetFilePointer)(HANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod); +BOOL WINAPI SFILE(ReadFile)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); +LCID WINAPI SFILE(SetLocale)(LCID nNewLocale); +BOOL WINAPI SFILE(GetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength); +BOOL WINAPI SFILE(SetBasePath)(LPCSTR lpNewBasePath); + +// Storm (de)compression functions +BOOL WINAPI SCOMP(Compress) (char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength, int uCmp, int uCmpType, int nCmpLevel); +BOOL WINAPI SCOMP(Decompress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength); + +#ifdef __cplusplus +} +#endif + +#if defined(_MSC_VER) && !defined(BUILDING_STORM_CPP) +#pragma comment(lib, "Storm.lib") // Force linking Storm.lib and thus Storm.dll +#endif + +#endif // __STORM_H__ diff --git a/storm_dll/storm.lib b/storm_dll/storm.lib deleted file mode 100644 index 3a68346..0000000 Binary files a/storm_dll/storm.lib and /dev/null differ diff --git a/storm_dll/storm.vcxproj b/storm_dll/storm.vcxproj new file mode 100644 index 0000000..ac64fd5 --- /dev/null +++ b/storm_dll/storm.vcxproj @@ -0,0 +1,197 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {BD600973-C6FA-4CE3-8821-67F6418B7F9C} + storm + Win32Proj + 10.0 + + + + DynamicLibrary + v142 + Unicode + true + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + true + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>16.0.31829.152 + + + .\bin\dll\$(Platform)\$(Configuration)\ + .\bin\dll\$(Platform)\$(Configuration)\ + true + false + + + .\bin\dll\$(Platform)\$(Configuration)\ + .\bin\dll\$(Platform)\$(Configuration)\ + true + false + + + .\bin\dll\$(Platform)\$(Configuration)\ + .\bin\dll\$(Platform)\$(Configuration)\ + false + false + + + .\bin\dll\$(Platform)\$(Configuration)\ + .\bin\dll\$(Platform)\$(Configuration)\ + false + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;storm_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreaded + + Level3 + EditAndContinue + + + $(OutDir)storm.dll + .\storm.def + true + Windows + 0x15000000 + + MachineX86 + false + + + + + X64 + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;storm_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + + + $(OutDir)storm.dll + .\storm.def + true + Windows + + + + MachineX64 + false + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;storm_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + + + $(OutDir)storm.dll + .\storm.def + true + Windows + true + true + 0x15000000 + + MachineX86 + false + + + + + X64 + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;storm_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + ProgramDatabase + + + $(OutDir)storm.dll + .\storm.def + true + Windows + true + true + + + + MachineX64 + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/storm_dll/storm.vcxproj.filters b/storm_dll/storm.vcxproj.filters new file mode 100644 index 0000000..c10e805 --- /dev/null +++ b/storm_dll/storm.vcxproj.filters @@ -0,0 +1,28 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + + + Source Files + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/storm_dll/storm_dll.cpp b/storm_dll/storm_dll.cpp deleted file mode 100644 index 2941f2a..0000000 --- a/storm_dll/storm_dll.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/*****************************************************************************/ -/* Storm.cpp Copyright (c) Ladislav Zezula 2003 */ -/*---------------------------------------------------------------------------*/ -/* This is just a dummy module for building import library for Storm.dll */ -/*---------------------------------------------------------------------------*/ -/* Date Ver Who Comment */ -/* -------- ---- --- ------- */ -/* 11.04.03 1.00 Lad The first version of Storm.cpp */ -/*****************************************************************************/ - -#include - -#define BUILDING_STORM_CPP -#define STORM_ALTERNATE_NAMES -#include "storm_dll.h" - -BOOL WINAPI SFILE(OpenArchive)(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, HANDLE *hMPQ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(CloseArchive)(HANDLE hMPQ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(GetArchiveName)(HANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(OpenFile)(LPCSTR lpFileName, HANDLE *hFile) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(OpenFileEx)(HANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, HANDLE *hFile) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(CloseFile)(HANDLE hFile) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -DWORD WINAPI SFILE(GetFileSize)(HANDLE hFile, LPDWORD lpFileSizeHigh) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(GetFileArchive)(HANDLE hFile, HANDLE *hMPQ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(GetFileName)(HANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -DWORD WINAPI SFILE(SetFilePointer)(HANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(ReadFile)(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -LCID WINAPI SFILE(SetLocale)(LCID nNewLocale) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(GetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(SetBasePath)(LPCSTR lpNewBasePath) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SFILE(Destroy)() -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SCOMP(Compress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength, int uCmp, int uCmpType, int nCmpLevel) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -BOOL WINAPI SCOMP(Decompress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} diff --git a/storm_dll/storm_dll.def b/storm_dll/storm_dll.def deleted file mode 100644 index 8de88f5..0000000 --- a/storm_dll/storm_dll.def +++ /dev/null @@ -1,25 +0,0 @@ -; Storm definition file with alternate Storm.dll names -LIBRARY "Storm" - -EXPORTS - StormCloseArchive @252 ; 0x0FC - StormCloseFile @253 ; 0x0FD - StormDestroy @262 ; 0x106 - StormGetFileArchive @264 ; 0x108 - StormGetFileSize @265 ; 0x109 - StormOpenArchive @266 ; 0x10A - StormOpenFile @267 ; 0x10B - StormOpenFileEx @268 ; 0x10C - StormReadFile @269 ; 0x10D - StormSetBasePath @270 ; 0x10E - StormSetFilePointer @271 ; 0x10F - StormSetLocale @272 ; 0x110 - StormGetBasePath @273 ; 0x111 - StormGetArchiveName @275 ; 0x113 - StormGetFileName @276 ; 0x114 - -; StormSetLastError @465 ; 0x - - StormCompress @551 ; 0x227 - StormDecompress @552 ; 0x228 - \ No newline at end of file diff --git a/storm_dll/storm_dll.h b/storm_dll/storm_dll.h deleted file mode 100644 index 75681b8..0000000 --- a/storm_dll/storm_dll.h +++ /dev/null @@ -1,65 +0,0 @@ -/*****************************************************************************/ -/* Storm.h Copyright Justin Olbrantz(Quantam) 2000 */ -/*---------------------------------------------------------------------------*/ -/* Storm Interface Library v1.0 for Windows */ -/* */ -/* Author : Justin Olbrantz(Quantam) */ -/* E-mail : omega@dragonfire.net */ -/* WWW : www.campaigncreations.com/starcraft/mpq2k/inside_mopaq/ */ -/*---------------------------------------------------------------------------*/ -/* Date Ver Who Comment */ -/* -------- ---- --- ------- */ -/* xx.xx.00 1.00 Qua The first version of Storm.h */ -/* 11.04.03 1.00 Lad Added some functions */ -/*****************************************************************************/ - -#ifndef __STORM_H__ -#define __STORM_H__ - -// We need the Windows data types for the Storm prototypes -#include - -// Sometimes is necessary to change the function names so they -// will not conflict with other MPQ tools. -#ifdef STORM_ALTERNATE_NAMES - #define SFILE(Name) Storm##Name - #define SCOMP(Name) Storm##Name -#else - #define SFILE(Name) SFile##Name - #define SCOMP(Name) SComp##Name -#endif - -// Make sure the functions are exported as C functions -#ifdef __cplusplus -extern "C" { -#endif - -// Storm file function prototypes -BOOL WINAPI SFILE(OpenArchive)(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, HANDLE *hMPQ); -BOOL WINAPI SFILE(CloseArchive)(HANDLE hMPQ); -BOOL WINAPI SFILE(GetArchiveName)(HANDLE hMPQ, LPCSTR lpBuffer, DWORD dwBufferLength); -BOOL WINAPI SFILE(OpenFile)(LPCSTR lpFileName, HANDLE *hFile); -BOOL WINAPI SFILE(OpenFileEx)(HANDLE hMPQ, LPCSTR lpFileName, DWORD dwSearchScope, HANDLE *hFile); -BOOL WINAPI SFILE(CloseFile)(HANDLE hFile); -DWORD WINAPI SFILE(GetFileSize)(HANDLE hFile, LPDWORD lpFileSizeHigh); -BOOL WINAPI SFILE(GetFileArchive)(HANDLE hFile, HANDLE *hMPQ); -BOOL WINAPI SFILE(GetFileName)(HANDLE hFile, LPCSTR lpBuffer, DWORD dwBufferLength); -DWORD WINAPI SFILE(SetFilePointer)(HANDLE hFile, long lDistanceToMove, PLONG lplDistanceToMoveHigh, DWORD dwMoveMethod); -BOOL WINAPI SFILE(ReadFile)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); -LCID WINAPI SFILE(SetLocale)(LCID nNewLocale); -BOOL WINAPI SFILE(GetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength); -BOOL WINAPI SFILE(SetBasePath)(LPCSTR lpNewBasePath); - -// Storm (de)compression functions -BOOL WINAPI SCOMP(Compress) (char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength, int uCmp, int uCmpType, int nCmpLevel); -BOOL WINAPI SCOMP(Decompress)(char * pbOutBuffer, int * pdwOutLength, char * pbInBuffer, int dwInLength); - -#ifdef __cplusplus -} -#endif - -#if defined(_MSC_VER) && !defined(BUILDING_STORM_CPP) -#pragma comment(lib, "Storm.lib") // Force linking Storm.lib and thus Storm.dll -#endif - -#endif // __STORM_H__ diff --git a/storm_dll/storm_test.cpp b/storm_dll/storm_test.cpp index 92ff061..397c4dd 100644 --- a/storm_dll/storm_test.cpp +++ b/storm_dll/storm_test.cpp @@ -17,30 +17,63 @@ #endif #define STORM_ALTERNATE_NAMES // Use Storm* prefix for functions -#include "storm_dll.h" // Header file for Storm.dll +#include "storm.h" // Header file for Storm.dll //----------------------------------------------------------------------------- // Main -int main() +int main(int argc, char * argv[]) { - LPCSTR szArchiveName = "e:\\war3.mpq"; + LPCSTR szArchiveName; + LPCSTR szFileName; + LPCSTR szFormat; HANDLE hMpq = NULL; HANDLE hFile = NULL; BYTE Buffer[0x100]; DWORD dwBytesRead = 0; + DWORD dwFileSize = 0; + BOOL bResult; + // Check parameters + if(argc != 3) + { + printf("Error: Missing MPQ or file name\n"); + return 3; + } + + // Get both arguments + SetLastError(ERROR_SUCCESS); + szArchiveName = argv[1]; + szFileName = argv[2]; + + // Put Storm.dll to the current folder before running this + printf("[*] Opening archive '%s' ...\n", szArchiveName); if(StormOpenArchive(szArchiveName, 0, 0, &hMpq)) { - if(StormOpenFileEx(hMpq, "(1)TheDeathSheep.w3m", 0, &hFile)) + printf("[*] Opening file '%s' ...\n", szFileName); + if(StormOpenFileEx(hMpq, "staredit\\scenario.chk", 0, &hFile)) { - dwBytesRead = StormGetFileSize(hFile, NULL); - StormReadFile(hFile, Buffer, sizeof(Buffer), &dwBytesRead, NULL); + printf("[*] Retrieving file size ... "); + dwFileSize = StormGetFileSize(hFile, NULL); + szFormat = (dwFileSize == INVALID_FILE_SIZE) ? ("(invalid)\n") : ("(%u bytes)\n"); + printf(szFormat, dwFileSize); + + printf("[*] Moving to begin of the file ...\n"); + StormSetFilePointer(hFile, 0, NULL, FILE_BEGIN); + + printf("[*] Reading file ... "); + bResult = StormReadFile(hFile, Buffer, sizeof(Buffer), &dwBytesRead, NULL); + szFormat = (bResult == FALSE) ? ("(error %u)\n") : ("(OK)\n"); + printf(szFormat, GetLastError()); + + printf("[*] Closing file ...\n"); StormCloseFile(hFile); } + printf("[*] Closing archive ...\n"); StormCloseArchive(hMpq); } + printf("Done.\n\n"); return 0; } diff --git a/storm_dll/storm_test.vcxproj b/storm_dll/storm_test.vcxproj new file mode 100644 index 0000000..48058ff --- /dev/null +++ b/storm_dll/storm_test.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE} + storm_test + Win32Proj + 10.0 + + + + Application + v142 + MultiByte + + + Application + v142 + MultiByte + + + Application + v142 + MultiByte + + + Application + v142 + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>16.0.31829.152 + + + .\bin\$(Platform)\$(Configuration)\ + .\bin\$(Platform)\$(Configuration)\ + true + + + .\bin\$(Platform)\$(Configuration)\ + .\bin\$(Platform)\$(Configuration)\ + true + + + .\bin\$(Platform)\$(Configuration)\ + .\bin\$(Platform)\$(Configuration)\ + false + + + .\bin\$(Platform)\$(Configuration)\ + .\bin\$(Platform)\$(Configuration)\ + false + + + + Disabled + ../aaa/inc;exif;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + Level4 + EditAndContinue + + + $(OutDir)storm_test.exe + .\bin\dll\Win32\Release;%(AdditionalLibraryDirectories) + true + $(OutDir)storm_test.pdb + Console + false + + MachineX86 + false + + + + + X64 + + + Disabled + ../aaa/inc;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + Level4 + ProgramDatabase + + + $(OutDir)storm_test.exe + .\bin\dll\x64\Release;%(AdditionalLibraryDirectories) + true + $(OutDir)storm_test.pdb + Console + false + + MachineX64 + false + + + + + ../aaa/inc;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + Level4 + ProgramDatabase + + + $(OutDir)storm_test.exe + .\bin\dll\Win32\Release;%(AdditionalLibraryDirectories) + true + Console + true + true + false + + MachineX86 + false + + + + + + + + X64 + + + ../aaa/inc;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + + Level4 + ProgramDatabase + + + $(OutDir)storm_test.exe + .\bin\dll\x64\Release;%(AdditionalLibraryDirectories) + true + Console + true + true + false + + MachineX64 + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/storm_dll/storm_test.vcxproj.filters b/storm_dll/storm_test.vcxproj.filters new file mode 100644 index 0000000..3345f52 --- /dev/null +++ b/storm_dll/storm_test.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {10b55df7-950e-4099-ab74-ee928278fc62} + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/storm_dll/storm_test_vs08.vcproj b/storm_dll/storm_test_vs08.vcproj deleted file mode 100644 index 456b11e..0000000 --- a/storm_dll/storm_test_vs08.vcproj +++ /dev/null @@ -1,359 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/storm_dll/storm_vs19.sln b/storm_dll/storm_vs19.sln new file mode 100644 index 0000000..b658180 --- /dev/null +++ b/storm_dll/storm_vs19.sln @@ -0,0 +1,43 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31911.196 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storm", "storm.vcxproj", "{BD600973-C6FA-4CE3-8821-67F6418B7F9C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "storm_test", "storm_test.vcxproj", "{5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}" + ProjectSection(ProjectDependencies) = postProject + {BD600973-C6FA-4CE3-8821-67F6418B7F9C} = {BD600973-C6FA-4CE3-8821-67F6418B7F9C} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|Win32.ActiveCfg = Debug|Win32 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|Win32.Build.0 = Debug|Win32 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|x64.ActiveCfg = Debug|x64 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Debug|x64.Build.0 = Debug|x64 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|Win32.ActiveCfg = Release|Win32 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|Win32.Build.0 = Release|Win32 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|x64.ActiveCfg = Release|x64 + {BD600973-C6FA-4CE3-8821-67F6418B7F9C}.Release|x64.Build.0 = Release|x64 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|Win32.Build.0 = Debug|Win32 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|x64.ActiveCfg = Debug|x64 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Debug|x64.Build.0 = Debug|x64 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|Win32.ActiveCfg = Release|Win32 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|Win32.Build.0 = Release|Win32 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|x64.ActiveCfg = Release|x64 + {5B0E680A-EC4E-402E-AE0D-18ADD2DC6EBE}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ADD59899-BF23-49D6-9CAA-479813B6604A} + EndGlobalSection +EndGlobal diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 88b12d9..4e8e600 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -4330,7 +4330,7 @@ int _tmain(int argc, TCHAR * argv[]) for(int i = 2; i < argc; i++) { - TestArchive(argv[i], NULL, TFLG_FILE_LOCALE | 0x0409, "File00000014.xxx", NULL); + TestArchive(argv[i], NULL, TFLG_FILE_LOCALE | 0x0000, "staredit\\scenario.chk", NULL); } // -- cgit v1.2.3