Skip to content

Commit

Permalink
Merge pull request #367 from ladislav-zezula/LZ_FileNameSafe
Browse files Browse the repository at this point in the history
Lz file name safe
  • Loading branch information
ladislav-zezula authored Nov 2, 2024
2 parents d055431 + df2ba2d commit 86f9b99
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
10 changes: 7 additions & 3 deletions doc/History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
StormLib history
================

Version 9.30

- Added functions for conversions between file names and safe operating system file names

Version 9.11

- Fixed bug in processing HET table.
Expand Down Expand Up @@ -34,21 +38,21 @@
- Updated support for protected maps from Warcraft III

Version 7.11

- Support for MPQs v 3.0 (WOW-Cataclysm BETA)
- StormLib now deals properly with files that have MPQ_SECTOR_CHECKSUM missing,
but have sector checksum entry present in the sector offset table

Version 7.10

- Support for partial MPQs ("interface.MPQ.part")
- The only operation that is externally allowed to do with internal files
("(listfile)", "(attributes)" and "(signature)") is reading. Attempt to modify any of the file
fails and GetLastError returns ERROR_INTERNAL_FILE
- Fixed memory leak that has occured when writing more than one sector to the file at once

Version 7.01

- Support for adding files from memory
- Fixed improper validation of handles to MPQ file and MPQ archive
- Fixed bug where StormLib didn't save CRC32 of the file when added to archive
Expand Down
3 changes: 3 additions & 0 deletions src/DllMain.def
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ EXPORTS
SFileSetDataCompression
SFileSetAddFileCallback

SMemUTF8ToFileName
SMemFileNameToUTF8

SCompImplode
SCompExplode
SCompCompress
Expand Down
3 changes: 1 addition & 2 deletions storm_dll/storm.def
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ EXPORTS
StormGetArchiveName @275 ; 0x113
StormGetFileName @276 ; 0x114

; StormSetLastError @465 ; 0x
; StormSetLastError @465 ; 0x1d1

StormCompress @551 ; 0x227
StormDecompress @552 ; 0x228

6 changes: 6 additions & 0 deletions storm_dll/storm.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
// will not conflict with other MPQ tools.
#ifdef STORM_ALTERNATE_NAMES
#define SFILE(Name) Storm##Name
#define SMEM(Name) Storm##Name
#define SCOMP(Name) Storm##Name
#else
#define SFILE(Name) SFile##Name
#define SMEM(Name) SMem##Name
#define SCOMP(Name) SComp##Name
#endif

Expand All @@ -50,6 +52,10 @@ LCID WINAPI SFILE(SetLocale)(LCID nNewLocale);
BOOL WINAPI SFILE(GetBasePath)(LPCSTR lpBuffer, DWORD dwBufferLength);
BOOL WINAPI SFILE(SetBasePath)(LPCSTR lpNewBasePath);

// File name safe functions
BOOL WINAPI SMEM(UTF8ToFileName)(LPTSTR szBuffer, size_t ccBuffer, const void * lpString, const void * lpStringEnd, DWORD dwFlags, size_t * pOutLength);
BOOL WINAPI SMEM(FileNameToUTF8)(void * lpBuffer, size_t ccBuffer, const TCHAR * szString, const TCHAR * szStringEnd, DWORD dwFlags, size_t * pOutLength);

// 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);
Expand Down

0 comments on commit 86f9b99

Please sign in to comment.