diff --git a/DarkEdif/DarkEdif Template/DarkExt.json b/DarkEdif/DarkEdif Template/DarkExt.json index eeefd454..bb1f591b 100644 --- a/DarkEdif/DarkEdif Template/DarkExt.json +++ b/DarkEdif/DarkEdif Template/DarkExt.json @@ -77,6 +77,11 @@ { "Type": "FolderEnd" }, + { + "Title": "Props outside folder", + "Info": "This blue header is called a group inside the DarkExt.json file.", + "Type": "Group" + }, { "Title": "Static text 1", "Info": "Blank text", @@ -139,7 +144,7 @@ "About": { "Name": "Exemple objet", "Author": "Votre Nom", - "Copyright": "Copyright \u00A9 2022 par Votre Nom", + "Copyright": "Copyright \u00A9 2026 par Votre Nom", "Comment": "Une ou deux phrases pour décrire votre poste", "Help": "Help/Example.chm", "URL": "http://www.example.com/" @@ -209,6 +214,11 @@ { "Type": "FolderEnd" }, + { + "Title": "Groupe", + "Info": "Voir le fichier DarkExt.json.", + "Type": "Group" + }, { "Title": "Texte statique 1", "Info": "Texte vide", diff --git a/DarkEdif/DarkEdif Template/Edittime.cpp b/DarkEdif/DarkEdif Template/Edittime.cpp index 95885540..62555fb7 100644 --- a/DarkEdif/DarkEdif Template/Edittime.cpp +++ b/DarkEdif/DarkEdif Template/Edittime.cpp @@ -19,7 +19,11 @@ int FusionAPI MakeIconEx(mv * mV, cSurface * pIconSf, TCHAR * lpName, ObjInfo * { #pragma DllExportHint pIconSf->Delete(); + #ifdef MULTIPLEICONS + pIconSf->Clone(*Edif::SDK->Image); + #else pIconSf->Clone(*Edif::SDK->Icon); + #endif pIconSf->SetTransparentColor(RGB(255, 0, 255)); return 0; @@ -153,6 +157,8 @@ BOOL FusionAPI EditObject(mv *mV, ObjInfo * oiPtr, LevelObject * loPtr, EDITDATA // PROPERTIES // ============================================================================ +#ifndef NOPROPS + // Inserts properties into the properties of the object. BOOL FusionAPI GetProperties(mv * mV, EDITDATA * edPtr, BOOL bMasterItem) { @@ -227,6 +233,7 @@ void FusionAPI ReleasePropCreateParam(mv *mV, EDITDATA *edPtr, unsigned int Prop #pragma DllExportHint return DarkEdif::DLL::DLL_ReleasePropCreateParam(mV, edPtr, PropID, lParam); } +#endif // ============================================================================ // ROUTINES USED WHEN BUILDING diff --git a/DarkEdif/DarkEdif Template/Ext.rc b/DarkEdif/DarkEdif Template/Ext.rc index 7a032d2a..e27e3368 100644 --- a/DarkEdif/DarkEdif Template/Ext.rc +++ b/DarkEdif/DarkEdif Template/Ext.rc @@ -154,6 +154,9 @@ END #if EditorBuild IDR_EDIF_ICON Edif "Icon.png" +#ifdef MULTIPLEICONS +IDR_EDIF_IMAGE Edif "Image.png" +#endif #if !defined(DARKEXT_JSON_FILE_EXTERNAL) IDR_EDIF_JSON Edif "DarkExt.json" #endif diff --git a/DarkEdif/DarkEdif Template/Image.png b/DarkEdif/DarkEdif Template/Image.png new file mode 100644 index 00000000..e5e942d4 Binary files /dev/null and b/DarkEdif/DarkEdif Template/Image.png differ diff --git a/DarkEdif/DarkEdif Template/Resource.h b/DarkEdif/DarkEdif Template/Resource.h index 576dc597..e0c57c4a 100644 --- a/DarkEdif/DarkEdif Template/Resource.h +++ b/DarkEdif/DarkEdif Template/Resource.h @@ -2,6 +2,9 @@ // Microsoft Developer Studio generated include file. // Used by Ext.rc // +#ifdef MULTIPLEICONS +#define IDR_EDIF_IMAGE 100 +#endif #define IDR_EDIF_ICON 101 #define IDR_EDIF_JSON 102 diff --git a/DarkEdif/Inc/Shared/Edif.hpp b/DarkEdif/Inc/Shared/Edif.hpp index 8dcaa784..ece83500 100644 --- a/DarkEdif/Inc/Shared/Edif.hpp +++ b/DarkEdif/Inc/Shared/Edif.hpp @@ -162,6 +162,10 @@ namespace Edif #if EditorBuild cSurface * Icon = nullptr; DarkEdif::Surface * ExtIcon = nullptr; +#ifdef MULTIPLEICONS + cSurface * Image = nullptr; + DarkEdif::Surface * ExtImage = nullptr; +#endif std::unique_ptr EdittimeProperties; #ifndef NOPROPS diff --git a/DarkEdif/Lib/Shared/DarkEdif.cpp b/DarkEdif/Lib/Shared/DarkEdif.cpp index d3070faf..aec4c79f 100644 --- a/DarkEdif/Lib/Shared/DarkEdif.cpp +++ b/DarkEdif/Lib/Shared/DarkEdif.cpp @@ -2,6 +2,7 @@ #include "Extension.hpp" #include #include +#include #ifdef _WIN32 extern HINSTANCE hInstLib; diff --git a/DarkEdif/Lib/Shared/Edif.cpp b/DarkEdif/Lib/Shared/Edif.cpp index a1899f5c..ebf45f22 100644 --- a/DarkEdif/Lib/Shared/Edif.cpp +++ b/DarkEdif/Lib/Shared/Edif.cpp @@ -698,6 +698,53 @@ Edif::SDKClass::SDKClass(mv * mV, json_value &_json) : json (_json) DarkEdif::MsgBox::Error(_T("DarkEdif error"), _T("Blitting to ext icon surface failed. Last error: %i."), tempIcon->GetLastError()); } ExtIcon = new DarkEdif::Surface(nullptr, Icon); + + #ifdef MULTIPLEICONS + Image = new cSurface(); + char * ImageData; + size_t ImageSize; + + int resultTwo = Edif::GetDependency (ImageData, ImageSize, _T("png"), IDR_EDIF_IMAGE); + if (resultTwo != Edif::DependencyNotFound) + { + CInputMemFile * File = CInputMemFile::NewInstance(); + File->Create((LPBYTE)ImageData, ImageSize); + + const std::unique_ptr tempImage = std::make_unique(); + const bool loadedOK = ImportImageFromInputFile(mV->ImgFilterMgr, File, tempImage.get(), NULL, 0); + if (!loadedOK) + { + // Read PNG bit depth: Skip 8 byte PNG header, IHDR 4 byte chunk length/type, img width/height, + // and then get bit depth byte. + // 4 bit or less bit depth is not loadable by Fusion's PNG filter. + const std::uint8_t bitDepth = File->GetMemBuffer()[8 + 4 + 4 + 4 + 4]; + + if (bitDepth <= 4) + DarkEdif::MsgBox::Error(_T("Failed to load ext image"), _T("" PROJECT_NAME "'s Image.png uses a bit depth of %hhu, which is too small."), bitDepth); + else + DarkEdif::MsgBox::Error(_T("Failed to load ext image"), _T("" PROJECT_NAME "'s Image.png failed to load.")); + } + + File->Delete(); + + if (!tempImage->HasAlpha()) + tempImage->SetTransparentColor(RGB(255, 0, 255)); + + if (resultTwo != Edif::DependencyWasResource) + free(ImageData); + + Image->Create(tempImage->GetWidth(), tempImage->GetHeight(), proto); + + if (!tempImage->HasAlpha()) + Image->SetTransparentColor(RGB(255, 0, 255)); + else + Image->CreateAlpha(); + + if (loadedOK && tempImage->Blit(*Image) == FALSE) + DarkEdif::MsgBox::Error(_T("DarkEdif error"), _T("Blitting to ext image surface failed. Last error: %i."), tempImage->GetLastError()); + } + ExtImage = new DarkEdif::Surface(nullptr, Image); + #endif } #if USE_DARKEDIF_UPDATE_CHECKER diff --git a/MMF2SDK/VOLINFO/Ext.rc b/MMF2SDK/VOLINFO/Ext.rc deleted file mode 100644 index 99921718..00000000 --- a/MMF2SDK/VOLINFO/Ext.rc +++ /dev/null @@ -1,214 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -// Wraps str into double-quotes, like "str". This function cannot be defined via /D. -#define sub_asStr(str) "" #str "" -#define asStr(str) sub_asStr(str) - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "..\Inc\ccx.h" -#define APSTUDIO_HIDDEN_SYMBOLS -#include -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif // _WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -1 VERSIONINFO - FILEVERSION 1,0,0,EXTENSION_VERSION - PRODUCTVERSION 1,0,0,EXTENSION_VERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0 -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "ProductName", PROJECT_NAME "\0" - VALUE "CompanyName", COMPANY_NAME "\0" - VALUE "FileDescription", PROJECT_NAME ", " asStr(CONFIG) " build " asStr(EXTENSION_VERSION) ".\0" - VALUE "FileVersion", "2.00" "\0" - VALUE "InternalName", PROJECT_NAME ".mfx\0" - VALUE "LegalCopyright", "Copyright \xA9 " YEAR " " COMPANY_NAME "\0" - VALUE "OriginalFilename", PROJECT_NAME ".mfx\0" - VALUE "ProductVersion", "Build " asStr(EXTENSION_VERSION) ", date " BUILD_DATE ".\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Data -// - -KPX_MAGICNUMBER RCDATA -BEGIN - 0x9978, 0x8989 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -EXO_ICON$(EDITOR) BITMAP "RES\\EXTICON.BMP" -#else -EXO_ICON BITMAP "RES\\EXTICON.BMP" -#endif -#endif -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -EXO_IMAGE$(EDITOR) BITMAP "RES\\EXTIMG.BMP" -#else -EXO_IMAGE BITMAP "RES\\EXTIMG.BMP" -#endif -#endif - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -MN_CONDITIONS$(EDITOR) MENU -#else -MN_CONDITIONS MENU -#endif -BEGIN - MENUITEM "", 65535 -END -#endif - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -MN_ACTIONS$(EDITOR) MENU -#else -MN_ACTIONS MENU -#endif -BEGIN - MENUITEM "", 65535 -END -#endif - -#if defined(APSTUDIO_INVOKED) || defined(EDITOR) -#if defined(APSTUDIO_INVOKED) -MN_EXPRESSIONS$(EDITOR) MENU -#else -MN_EXPRESSIONS MENU -#endif -BEGIN - POPUP "" - BEGIN - MENUITEM "Get Volume Label", IDMN_EXPRESSION2 - END -END -#endif - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""..\\Inc\\ccx.h""\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include \r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - KPX_MARK "MF2" - KPX_NAME "NRG753 Volume Information" -END - -STRINGTABLE -BEGIN - M_EXPRESSION2 "VolInfo$(" -END - -STRINGTABLE -BEGIN - IDST_OBJNAME "NRG753 Volume Information" - IDST_AUTHOR "Jack Webster" - IDST_COPYRIGHT "Copyright \xA9 2006 Jack Webster" - IDST_COMMENT "Given a root path, will give the volumes label. By request of NRG753" - IDST_HTTP "(No webpage right now)" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/MMF2SDK/VOLINFO/VOLINFO.vcxproj b/MMF2SDK/VOLINFO/VOLINFO.vcxproj deleted file mode 100644 index 3532a72d..00000000 --- a/MMF2SDK/VOLINFO/VOLINFO.vcxproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - Win32 - - - Edittime - Win32 - - - Runtime - Win32 - - - Vitalize - Win32 - - - - {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145} - VOLINFO - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MMF2SDK_Unicode/VOLINFO/.gitattributes b/MMF2SDK_Unicode/VOLINFO/.gitattributes new file mode 100644 index 00000000..412eeda7 --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/MMF2SDK_Unicode/VOLINFO/.gitignore b/MMF2SDK_Unicode/VOLINFO/.gitignore new file mode 100644 index 00000000..5ebd21a1 --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/.gitignore @@ -0,0 +1,163 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +#packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/MMF2SDK/VOLINFO/Common.h b/MMF2SDK_Unicode/VOLINFO/Common.h similarity index 87% rename from MMF2SDK/VOLINFO/Common.h rename to MMF2SDK_Unicode/VOLINFO/Common.h index 40061092..5ec7b90f 100644 --- a/MMF2SDK/VOLINFO/Common.h +++ b/MMF2SDK_Unicode/VOLINFO/Common.h @@ -6,24 +6,26 @@ #define _CRTDBG_MAP_ALLOC 1 #endif +#define IN_EXT_VERSION2 + // ---------------------------------------------- // VERSION AND BUILD YOUR EXTENSION CAN WORK WITH // ---------------------------------------------- -//#define TGFEXT // TGF, MMF Standard and MMF Pro +//#define TGFEXT // TGF, MMF Standard and MMF Pro #define MMFEXT // MMF Standard and MMF Pro -//#define PROEXT // MMF Pro only +//#define PROEXT // MMF Pro only // Build number of the minimum required version of MMF #define MINBUILD 228 // General includes -#include "ccxhdr.h" -#include "Surface.h" +#include "ccxhdr.h" +#include "Surface.h" // Specific to this cox -#include "resource.h" -#include "main.h" -#include "TigsExt.hpp" +#include "resource.h" +#include "main.h" +#include "TigsExt.hpp" // Globals and Prototypes extern HINSTANCE hInstLib; diff --git a/MMF2SDK/VOLINFO/Edittime.cpp b/MMF2SDK_Unicode/VOLINFO/Edittime.cpp similarity index 95% rename from MMF2SDK/VOLINFO/Edittime.cpp rename to MMF2SDK_Unicode/VOLINFO/Edittime.cpp index 3ef1adaf..ac2ea78f 100644 --- a/MMF2SDK/VOLINFO/Edittime.cpp +++ b/MMF2SDK_Unicode/VOLINFO/Edittime.cpp @@ -5,7 +5,7 @@ // under the Frame and Event editors. // // Including creating, display, and setting up your object. -// +// // ============================================================================ // Common @@ -21,8 +21,8 @@ enum { // Example // ------- -// PROPID_TEXTTITLE, -// PROPID_TEXT, +// PROPID_TEXTTITLE, +// PROPID_TEXT, // PROPID_CHECK, // PROPID_COMBO, // PROPID_COLOR, @@ -31,9 +31,9 @@ enum { // Example of content of the PROPID_COMBO combo box //LPCSTR ComboList[] = { // 0, // reserved -// MAKEINTRESOURCE(IDS_FIRSTOPTION), -// MAKEINTRESOURCE(IDS_SECONDOPTION), -// MAKEINTRESOURCE(IDS_THIRDOPTION), +// MAKEINTRESOURCE(IDS_FIRSTOPTION), +// MAKEINTRESOURCE(IDS_SECONDOPTION), +// MAKEINTRESOURCE(IDS_THIRDOPTION), // NULL //}; @@ -78,7 +78,7 @@ typedef struct tagSetP // Info displayed in the object's About properties // Note: ObjComment is also displayed in the Quick Description box in the Insert Object dialog box // -void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPSTR ObjName, LPSTR ObjAuthor, LPSTR ObjCopyright, LPSTR ObjComment, LPSTR ObjHttp) +void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPTSTR ObjName, LPTSTR ObjAuthor, LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) { #ifndef RUN_ONLY // Name @@ -103,7 +103,7 @@ void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPSTR ObjName, LP // ----------------- // Returns the help filename of the object. // -LPCSTR WINAPI GetHelpFileName() +LPCTSTR WINAPI GetHelpFileName() { #ifndef RUN_ONLY // Return a file without path if your help file can be loaded by the MMF help file. @@ -111,7 +111,7 @@ LPCSTR WINAPI GetHelpFileName() // Or return the path of your file, relatively to the MMF directory // if your file is not loaded by the MMF help file. - return "Help\\MyExt.chm"; + return _T("Help\\MyExt.chm"); #else return NULL; #endif // !defined(RUN_ONLY) @@ -161,7 +161,7 @@ WORD BmpToImg(int bmID, npAppli idApp, short HotX = 0, short HotY = 0, short Act // ============================================================================ // // ROUTINES USED UNDER FRAME EDITOR -// +// // ============================================================================ @@ -176,7 +176,7 @@ WORD BmpToImg(int bmID, npAppli idApp, short HotX = 0, short HotY = 0, short Act // If you need to draw the icon manually, remove the comments around this function and in the .def file. // /* -int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) +int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) { int error = -1; #ifndef RUN_ONLY @@ -196,7 +196,7 @@ int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPSTR lpName, // -------------------- // CreateObject // -------------------- -// Called when you choose "Create new object". It should display the setup box +// Called when you choose "Create new object". It should display the setup box // and initialize everything in the datazone. int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) @@ -276,7 +276,7 @@ void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, u { #ifndef RUN_ONLY // Is the last object removed? - if (0 == cpt) + if (0 == cpt) { // Do whatever necessary to remove our data } @@ -355,7 +355,7 @@ void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr // IsTransparent // -------------------- // This routine tells CC&C if the mouse pointer is over a transparent zone of the object. -// +// extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, int dx, int dy) { @@ -369,7 +369,7 @@ extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPED // PrepareToWriteObject // -------------------- // Just before writing the datazone when saving the application, CC&C calls this routine. -// +// void WINAPI DLLExport PrepareToWriteObject(mv _far *mV, LPEDATA edPtr, fpObjInfo adoi) { #ifndef RUN_ONLY @@ -401,20 +401,20 @@ BOOL WINAPI GetFilters(LPMV mV, LPEDATA edPtr, DWORD dwFlags, LPVOID pReserved) // Triggers when a file is dropped onto the frame // Return TRUE if you can create an object from the given file // -BOOL WINAPI DLLExport UsesFile (LPMV mV, LPSTR fileName) +BOOL WINAPI DLLExport UsesFile (LPMV mV, LPTSTR fileName) { BOOL r = FALSE; #ifndef RUN_ONLY // Example: return TRUE if file extension is ".txt" -/* - LPSTR ext, npath; +/* + LPTSTR ext, npath; if ( fileName != NULL ) { - if ( (ext=(LPSTR)malloc(_MAX_EXT)) != NULL ) + if ( (ext=(LPTSTR)malloc(_MAX_EXT)) != NULL ) { - if ( (npath=(LPSTR)malloc(_MAX_PATH)) != NULL ) + if ( (npath=(LPTSTR)malloc(_MAX_PATH)) != NULL ) { strcpy(npath, fileName); _splitpath(npath, NULL, NULL, NULL, ext); @@ -435,7 +435,7 @@ BOOL WINAPI DLLExport UsesFile (LPMV mV, LPSTR fileName) // -------------------- // Creates a new object from file // -void WINAPI DLLExport CreateFromFile (LPMV mV, LPSTR fileName, LPEDATA edPtr) +void WINAPI DLLExport CreateFromFile (LPMV mV, LPTSTR fileName, LPEDATA edPtr) { #ifndef RUN_ONLY // Initialize your extension data from the given file @@ -450,7 +450,7 @@ void WINAPI DLLExport CreateFromFile (LPMV mV, LPSTR fileName, LPEDATA edPtr) // ============================================================================ // // PROPERTIES -// +// // ============================================================================ // -------------------- @@ -536,7 +536,7 @@ LPVOID WINAPI DLLExport GetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID) // // // Returns a string // case PROPID_TEXT: -// return new CPropDataValue(&edPtr->szText[0]); +// return new CPropStringValue(&edPtr->szText[0]); // // // Returns the value of the combo box // case PROPID_COMBO: @@ -595,7 +595,7 @@ void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID // case PROPID_TEXT: // { // // Gets the string -// LPSTR pStr = (LPSTR)((CPropDataValue*)pValue)->m_pData; +// LPTSTR pStr = ((CPropStringValue*)pValue)->GetString(); // // // You can simply poke the string if your EDITDATA structure has a fixed size, // // or have an adaptive size of structure like below @@ -605,7 +605,7 @@ void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID // { // // Asks MMF to reallocate the structure with the new size // LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr)); -// +// // // If reallocation worked // if (pNewPtr!=NULL) // { @@ -615,7 +615,7 @@ void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID // } // } // else -// { +// { // // Same size : simply copy // strcpy(edPtr->text, pStr); // } @@ -699,7 +699,7 @@ BOOL WINAPI IsPropEnabled(LPMV mV, LPEDATA edPtr, UINT nPropID) // ============================================================================ // // TEXT PROPERTIES -// +// // ============================================================================ // -------------------- @@ -718,7 +718,7 @@ DWORD WINAPI DLLExport GetTextCaps(mv _far *mV, LPEDATA edPtr) // Return the font used the object. // Note: the pStyle and cbSize parameters are obsolete and passed for compatibility reasons only. // -BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPSTR pStyle, UINT cbSize) +BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPTSTR pStyle, UINT cbSize) { #if !defined(RUN_ONLY) // Example: copy LOGFONT structure from EDITDATA @@ -830,24 +830,24 @@ void WINAPI DLLExport SetTextAlignment(mv _far *mV, LPEDATA edPtr, DWORD dwAlign // // ROUTINES USED UNDER EVENT / TIME / STEP-THROUGH EDITOR // You should not need to change these routines -// +// // ============================================================================ // ----------------- // menucpy // ----------------- // Internal routine used later, copy one menu onto another -// -#ifndef RUN_ONLY +// void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) { +#ifndef RUN_ONLY int n, id, nMn; - NPSTR strBuf; + LPTSTR strBuf; HMENU hSubMenu; - + nMn = GetMenuItemCount(hSourceMenu); - strBuf = (NPSTR)LocalAlloc(LPTR, 80); - for (n=0; ninfos.code != code) eiPtr = EVINFO2_NEXT(eiPtr); - + return eiPtr; } -#endif // !defined(RUN_ONLY) +//#endif // !defined(RUN_ONLY) // ---------------------------------------------------- @@ -951,7 +952,7 @@ HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA e // #ifndef RUN_ONLY -void GetCodeTitle(LPEVENTINFOS2 eiPtr, short code, short param, short mn, LPSTR strBuf, WORD maxLen) +void GetCodeTitle(LPEVENTINFOS2 eiPtr, short code, short param, short mn, LPTSTR strBuf, WORD maxLen) { HMENU hMn; @@ -965,7 +966,7 @@ void GetCodeTitle(LPEVENTINFOS2 eiPtr, short code, short param, short mn, LPSTR LoadString(hInstLib, strID, strBuf, maxLen); else { - // Otherwise, returns the menu option + // Otherwise, returns the menu option if ((hMn = LoadMenu(hInstLib, MAKEINTRESOURCE(mn))) != NULL ) { GetMenuString(hMn, eiPtr->menu, strBuf, maxLen, MF_BYCOMMAND); @@ -977,15 +978,15 @@ void GetCodeTitle(LPEVENTINFOS2 eiPtr, short code, short param, short mn, LPSTR #define GetCodeTitle(a,b,c,d,e,f) #endif // !defined(RUN_ONLY) -void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPSTR strBuf, short maxLen) +void WINAPI DLLExport GetConditionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) { GetCodeTitle((LPEVENTINFOS2)conditionsInfos, code, param, MN_CONDITIONS, strBuf, maxLen); } -void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPSTR strBuf, short maxLen) +void WINAPI DLLExport GetActionTitle(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) { GetCodeTitle((LPEVENTINFOS2)actionsInfos, code, param, MN_ACTIONS, strBuf, maxLen); } -void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPSTR strBuf, short maxLen) +void WINAPI DLLExport GetExpressionTitle(mv _far *mV, short code, LPTSTR strBuf, short maxLen) { GetCodeTitle((LPEVENTINFOS2)expressionsInfos, code, 0, MN_EXPRESSIONS, strBuf, maxLen); } @@ -1005,7 +1006,7 @@ short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) for (n=CND_LAST, eiPtr=(LPEVENTINFOS2)conditionsInfos; n>0 && eiPtr->menu!=menuId; n--) eiPtr = EVINFO2_NEXT(eiPtr); - if (n>0) + if (n>0) return eiPtr->infos.code; #endif // !defined(RUN_ONLY) return -1; @@ -1019,7 +1020,7 @@ short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) for (n=ACT_LAST, eiPtr=(LPEVENTINFOS2)actionsInfos; n>0 && eiPtr->menu!=menuId; n--) eiPtr = EVINFO2_NEXT(eiPtr); - if (n>0) + if (n>0) return eiPtr->infos.code; #endif // !defined(RUN_ONLY) return -1; @@ -1033,7 +1034,7 @@ short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) for (n=EXP_LAST, eiPtr=(LPEVENTINFOS2)expressionsInfos; n>0 && eiPtr->menu!=menuId; n--) eiPtr = EVINFO2_NEXT(eiPtr); - if (n>0) + if (n>0) return eiPtr->infos.code; #endif // !defined(RUN_ONLY) return -1; @@ -1043,8 +1044,8 @@ short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) // ------------------------------------------------------- // GetConditionInfos / GetActionInfos / GetExpressionInfos // ------------------------------------------------------- -// From a action / condition / expression code, returns -// an infosEvents structure. +// From a action / condition / expression code, returns +// an infosEvents structure. // LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) @@ -1078,11 +1079,11 @@ LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) // ---------------------------------------------------------- // GetConditionString / GetActionString / GetExpressionString // ---------------------------------------------------------- -// From a action / condition / expression code, returns +// From a action / condition / expression code, returns // the string to use for displaying it under the event editor // -void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPSTR strPtr, short maxLen) +void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY // Check compatibility @@ -1091,7 +1092,7 @@ void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPSTR strPtr, #endif // !defined(RUN_ONLY) } -void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPSTR strPtr, short maxLen) +void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY // Check compatibility @@ -1100,7 +1101,7 @@ void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPSTR strPtr, sho #endif // !defined(RUN_ONLY) } -void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPSTR strPtr, short maxLen) +void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY // Check compatibility @@ -1114,7 +1115,7 @@ void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPSTR strPtr, // ---------------------------------------------------------- // Returns the parameter name to display in the expression editor // -void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPSTR strBuf, short maxLen) +void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, LPTSTR strBuf, short maxLen) { #if !defined(RUN_ONLY) short strID; @@ -1216,7 +1217,7 @@ void WINAPI EditParameter(mv _far *mV, short code, paramExt* pExt) // -------------------- // Initialize the parameter. // -void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPTSTR pDest, short size) { #if !defined(RUN_ONLY) diff --git a/MMF2SDK/VOLINFO/Ext.def b/MMF2SDK_Unicode/VOLINFO/Ext.def similarity index 100% rename from MMF2SDK/VOLINFO/Ext.def rename to MMF2SDK_Unicode/VOLINFO/Ext.def diff --git a/MMF2SDK_Unicode/VOLINFO/Ext.rc b/MMF2SDK_Unicode/VOLINFO/Ext.rc new file mode 100644 index 00000000..a4072c0c --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/Ext.rc @@ -0,0 +1,215 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "..\Inc\ccx.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x21L +#else + FILEFLAGS 0x20L +#endif + FILEOS 0x10001L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Clickteam\0" + VALUE "FileDescription", "NRG753 Volume Information\0" + VALUE "FileVersion", "2.00\0" + VALUE "InternalName", "VOLINFO\0" + VALUE "LegalCopyright", "Copyright � 2006 Jack Webster\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "VOLINFO.mfx\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "\0" + VALUE "ProductVersion", "1, 0, 0, 0\0" + VALUE "SpecialBuild", "00000001\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// Data +// + +KPX_MAGICNUMBER RCDATA MOVEABLE PURE +BEGIN + 0x9978, 0x8989 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +EXO_ICON$(EDITOR) BITMAP MOVEABLE PURE "RES\\EXTICON.BMP" +#else +EXO_ICON BITMAP MOVEABLE PURE "RES\\EXTICON.BMP" +#endif +#endif +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +EXO_IMAGE$(EDITOR) BITMAP MOVEABLE PURE "RES\\EXTIMG.BMP" +#else +EXO_IMAGE BITMAP MOVEABLE PURE "RES\\EXTIMG.BMP" +#endif +#endif + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +MN_CONDITIONS$(EDITOR) MENU DISCARDABLE +#else +MN_CONDITIONS MENU DISCARDABLE +#endif +BEGIN + MENUITEM "", 65535 +END +#endif + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +MN_ACTIONS$(EDITOR) MENU DISCARDABLE +#else +MN_ACTIONS MENU DISCARDABLE +#endif +BEGIN + MENUITEM "", 65535 +END +#endif + +#if defined(APSTUDIO_INVOKED) || defined(EDITOR) +#if defined(APSTUDIO_INVOKED) +MN_EXPRESSIONS$(EDITOR) MENU DISCARDABLE +#else +MN_EXPRESSIONS MENU DISCARDABLE +#endif +BEGIN + POPUP "" + BEGIN + MENUITEM "Get Volume Label", IDMN_EXPRESSION2 + MENUITEM SEPARATOR + END +END +#endif + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""..\\Inc\\ccx.h""\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + KPX_MARK "MF2" + KPX_NAME "NRG753 Volume Information" +END + +STRINGTABLE DISCARDABLE +BEGIN + M_EXPRESSION2 "VolInfo$(" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDST_OBJNAME "NRG753 Volume Information" + IDST_AUTHOR "Jack Webster" + IDST_COPYRIGHT "Copyright \xA9 2006-2026 Jack Webster" + IDST_COMMENT "Given a root path, will give the volumes label. By request of NRG753" + IDST_HTTP "(No webpage right now)" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/MMF2SDK/VOLINFO/General.cpp b/MMF2SDK_Unicode/VOLINFO/General.cpp similarity index 90% rename from MMF2SDK/VOLINFO/General.cpp rename to MMF2SDK_Unicode/VOLINFO/General.cpp index 670cbf39..986a4647 100644 --- a/MMF2SDK/VOLINFO/General.cpp +++ b/MMF2SDK_Unicode/VOLINFO/General.cpp @@ -4,7 +4,7 @@ // The following routines are used internally by MMF, and should not need to // be modified. // -// +// // ============================================================================ // Common Include @@ -15,13 +15,13 @@ HINSTANCE hInstLib; // ============================================================================ // // LIBRARY ENTRY & QUIT POINTS -// +// // ============================================================================ // ----------------- // Entry points // ----------------- -// Usually you do not need to do any initialization here: you will prefer to +// Usually you do not need to do any initialization here: you will prefer to // do them in "Initialize" found in Edittime.cpp BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { @@ -29,7 +29,7 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) { // DLL is attaching to the address space of the current process. case DLL_PROCESS_ATTACH: - + hInstLib = hDLL; // Store HINSTANCE break; @@ -42,10 +42,10 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) break; // The calling process is detaching the DLL from its address space. - case DLL_PROCESS_DETACH: + case DLL_PROCESS_DETACH: break; } - + return TRUE; } @@ -66,7 +66,7 @@ extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) // ----------------- // Where you want to kill and initialized data opened in the above routine // Called just before freeing the DLL. -// +// extern "C" int WINAPI DLLExport Free(mv _far *mV) { // No error @@ -76,18 +76,18 @@ extern "C" int WINAPI DLLExport Free(mv _far *mV) // ============================================================================ // // GENERAL INFO -// +// // ============================================================================ // ----------------- // Get Infos // ----------------- -// -extern "C" +// +extern "C" { DWORD WINAPI DLLExport GetInfos(int info) { - + switch (info) { case KGI_VERSION: @@ -98,6 +98,12 @@ extern "C" return PRODUCT_VERSION_STANDARD; // Works with MMF Standard or above case KGI_BUILD: return 240; // Works with build 240 or above + case KGI_UNICODE: + #ifdef _UNICODE + return TRUE; + #else + return FALSE; + #endif default: return 0; } @@ -109,7 +115,7 @@ extern "C" // ---------------------------------------------------------- // Fills an information structure that tells CC&C everything // about the object, its actions, conditions and expressions -// +// short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) { @@ -131,10 +137,10 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) // Identifier, for run-time identification infoPtr->identifier = IDENTIFIER; - + // Current version infoPtr->version = KCX_CURRENT_VERSION; - + return TRUE; } @@ -144,14 +150,14 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) // Returns the name of the external modules that you wish MMF to include // with stand-alone applications (these modules must be in the MMF // Data\Runtime folder). -// +// -//LPCSTR szDep[] = { -// "MyDll.dll", +//LPCTSTR szDep[] = { +// _T("MyDll.dll"), // NULL //}; -LPCSTR* WINAPI DLLExport GetDependencies() +LPCTSTR* WINAPI DLLExport GetDependencies() { return NULL; // szDep; } @@ -183,7 +189,7 @@ void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved) // -------------------- // For you to update your object structure to newer versions // Called at both edit time and run time -// +// HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr) { // We do nothing here @@ -198,9 +204,10 @@ HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr // Called at edit time and run time. // // Call lpfnUpdate to update your file pathname (refer to the documentation) -// -void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR)) +// +void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPTSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPTSTR, LPTSTR)) { + } // --------------------- @@ -209,22 +216,22 @@ void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, // // Uncomment this function if you need to store an image in the image bank. // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. // /* int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ +{ int error = 0; // Replace wImgIdx with the name of the WORD variable you create within the edit structure - - // Enum images + + // Enum images if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) { - // Undo enum images - undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } + // Undo enum images + undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } return error; } diff --git a/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.sln b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.sln new file mode 100644 index 00000000..ed072de5 --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.37327.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MMF2SDK - VOLINFO", "MMF2SDK - VOLINFO.vcxproj", "{2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Unicode|x86 = Debug Unicode|x86 + Debug|x86 = Debug|x86 + Edittime Unicode|x86 = Edittime Unicode|x86 + Edittime|x86 = Edittime|x86 + Runtime Unicode|x86 = Runtime Unicode|x86 + Runtime|x86 = Runtime|x86 + Vitalize|x86 = Vitalize|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Debug Unicode|x86.ActiveCfg = Debug Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Debug Unicode|x86.Build.0 = Debug Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Debug|x86.ActiveCfg = Debug|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Debug|x86.Build.0 = Debug|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Edittime Unicode|x86.ActiveCfg = Edittime Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Edittime Unicode|x86.Build.0 = Edittime Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Edittime|x86.ActiveCfg = Edittime|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Edittime|x86.Build.0 = Edittime|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Runtime Unicode|x86.ActiveCfg = Runtime Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Runtime Unicode|x86.Build.0 = Runtime Unicode|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Runtime|x86.ActiveCfg = Runtime|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Runtime|x86.Build.0 = Runtime|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Vitalize|x86.ActiveCfg = Vitalize|Win32 + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145}.Vitalize|x86.Build.0 = Vitalize|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {244770B2-A722-4976-85DA-F5FFB2A012A3} + EndGlobalSection +EndGlobal diff --git a/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcproj b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcproj new file mode 100644 index 00000000..43cd5121 --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcproj @@ -0,0 +1,807 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj new file mode 100644 index 00000000..632b655b --- /dev/null +++ b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj @@ -0,0 +1,678 @@ + + + + + Debug Unicode + Win32 + + + Debug + Win32 + + + Edittime Unicode + Win32 + + + Edittime + Win32 + + + Runtime Unicode + Win32 + + + Runtime + Win32 + + + Vitalize + Win32 + + + + {2196C17D-EDAC-43AD-AF88-1D7D6CBD9145} + MMF2SDK - VOLINFO + 10.0.19041.0 + + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + DynamicLibrary + false + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + .\Vitalize_Small\ + .\Vitalize_Small\ + false + .\Release_Small\ + .\Release_Small\Unicode\ + .\Release_Small\ + .\Release_Small\Unicode\ + false + false + .\Debug\ + .\Debug\Unicode\ + .\Debug\ + .\Debug\Unicode\ + true + true + .\Run_Only_Small\ + .\Run_Only_Small\Unicode\ + .\Run_Only_Small\ + .\Run_Only_Small\Unicode\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + false + false + false + false + false + false + false + false + false + + + + NDEBUG;RUN_ONLY;%(PreprocessorDefinitions) + true + true + Win32 + .\Vitalize_Small/Template.tlb + + + + + MinSpace + OnlyExplicitInline + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_WINDOWS;STRICT;RUN_ONLY;VITALIZE;COXSDK;%(PreprocessorDefinitions) + true + Sync + MultiThreaded + true + true + .\Vitalize_Small/Template.pch + .\Vitalize_Small/ + .\Vitalize_Small/ + .\Vitalize_Small/ + Level3 + true + + + NDEBUG;RUN_ONLY;VITALIZE;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Vitalize_Small\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MOX\$(ProjectName).mox + true + false + .\Ext.def + .\Vitalize_Small/Template.pdb + false + + + .\Vitalize_Small/Template.lib + MachineX86 + false + ..\..\lib\;%(AdditionalLibraryDirectories) + + + true + .\Vitalize_Small/Template.bsc + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release_Small/Template.tlb + + + + + MinSpace + OnlyExplicitInline + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_WINDOWS;STRICT;COXSDK;%(PreprocessorDefinitions) + true + Sync + MultiThreaded + true + true + .\Release_Small/Template.pch + .\Release_Small/ + .\Release_Small/ + .\Release_Small/ + Level3 + true + + + NDEBUG;EDITOR;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Release_Small\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\Extensions\$(ProjectName).mfx + true + false + .\Ext.def + .\Release_Small/Template.pdb + false + + + .\Release_Small/Template.lib + MachineX86 + ..\..\lib\;%(AdditionalLibraryDirectories) + + + true + .\Release_Small/Template.bsc + + + + + + + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release_Small/Template.tlb + + + + + MinSpace + OnlyExplicitInline + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_WINDOWS;STRICT;COXSDK;_UNICODE;UNICODE;%(PreprocessorDefinitions) + true + Sync + MultiThreaded + true + true + .\Release_Small/Template.pch + .\Release_Small/ + .\Release_Small/ + .\Release_Small/ + Level3 + true + + + NDEBUG;EDITOR;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Release_Small\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\Extensions\Unicode\$(ProjectName).mfx + true + false + .\Ext.def + .\Release_Small/Template.pdb + false + + + .\Release_Small/Template.lib + MachineX86 + ..\..\lib\;%(AdditionalLibraryDirectories) + + + true + .\Release_Small/Template.bsc + + + + + + + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/Template.tlb + + + + + Disabled + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_WINDOWS;STRICT;COXSDK;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;EDITOR;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Debug\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\Extensions\$(ProjectName).mfx + true + ..\lib\;..\..\lib\;%(AdditionalLibraryDirectories) + .\Ext.def + false + .\Debug/Template.pdb + false + + + .\Debug/Template.lib + MachineX86 + + + true + .\Debug/Template.bsc + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/Template.tlb + + + + + Disabled + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_WINDOWS;STRICT;COXSDK;_UNICODE;UNICODE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + .\Debug/ + .\Debug/ + .\Debug/ + Level3 + true + ProgramDatabase + + + _DEBUG;EDITOR;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Debug\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\DEBUG\Extensions\Unicode\$(ProjectName).mfx + true + ..\lib\;..\..\lib\;%(AdditionalLibraryDirectories) + .\Ext.def + false + .\Debug/Template.pdb + false + + + .\Debug/Template.lib + MachineX86 + + + true + .\Debug/Template.bsc + + + + + NDEBUG;RUN_ONLY;%(PreprocessorDefinitions) + true + true + Win32 + .\Run_Only_Small/Template.tlb + + + + + MinSpace + OnlyExplicitInline + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_WINDOWS;STRICT;RUN_ONLY;COXSDK;%(PreprocessorDefinitions) + true + Sync + MultiThreaded + true + true + .\Run_Only_Small/Template.pch + .\Run_Only_Small/ + .\Run_Only_Small/ + .\Run_Only_Small/ + Level3 + true + + + NDEBUG;RUN_ONLY;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Run_Only_Small\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\Data\Runtime\$(ProjectName).mfx + true + false + .\Ext.def + $(ProjectDir)..\..\MFX\Data\Runtime\$(ProjectName)_Full.pdb + false + + + .\Run_Only_Small/Template.lib + MachineX86 + true + $(ProjectDir)..\..\MFX\Data\Runtime\$(ProjectName).pdb + ..\..\lib\;%(AdditionalLibraryDirectories) + + + true + .\Run_Only_Small/Template.bsc + + + + + + + + + + + NDEBUG;RUN_ONLY;%(PreprocessorDefinitions) + true + true + Win32 + .\Run_Only_Small/Template.tlb + + + + + MinSpace + OnlyExplicitInline + ..\Inc;.\;..\..\Inc;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_WINDOWS;STRICT;RUN_ONLY;COXSDK;_UNICODE;UNICODE;%(PreprocessorDefinitions) + true + Sync + MultiThreaded + true + true + .\Run_Only_Small/Template.pch + .\Run_Only_Small/ + .\Run_Only_Small/ + .\Run_Only_Small/ + Level3 + true + + + NDEBUG;RUN_ONLY;%(PreprocessorDefinitions) + 0x0409 + ..\..\Inc;%(AdditionalIncludeDirectories) + .\Run_Only_Small\Ext.res + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;..\lib\mmfs2.lib;%(AdditionalDependencies) + $(ProjectDir)MFX\Data\Runtime\Unicode\$(ProjectName).mfx + true + false + .\Ext.def + $(ProjectDir)..\..\MFX\Data\Runtime\$(ProjectName)_Full.pdb + false + + + .\Run_Only_Small/Template.lib + MachineX86 + true + $(ProjectDir)..\..\MFX\Data\Runtime\$(ProjectName).pdb + ..\..\lib\;%(AdditionalLibraryDirectories) + + + true + .\Run_Only_Small/Template.bsc + + + + + + + + + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + + + + + + \ No newline at end of file diff --git a/MMF2SDK/VOLINFO/VOLINFO.vcxproj.filters b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj.filters similarity index 98% rename from MMF2SDK/VOLINFO/VOLINFO.vcxproj.filters rename to MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj.filters index 794fd3f0..8b5e055f 100644 --- a/MMF2SDK/VOLINFO/VOLINFO.vcxproj.filters +++ b/MMF2SDK_Unicode/VOLINFO/MMF2SDK - VOLINFO.vcxproj.filters @@ -32,15 +32,15 @@ + + Source Files + Resource Files Resource Files - - Resource Files - @@ -49,6 +49,9 @@ Header Files + + Header Files + MMF Headers @@ -139,9 +142,6 @@ MMF Headers - - Resource Files - diff --git a/MMF2SDK/VOLINFO/Main.cpp b/MMF2SDK_Unicode/VOLINFO/Main.cpp similarity index 88% rename from MMF2SDK/VOLINFO/Main.cpp rename to MMF2SDK_Unicode/VOLINFO/Main.cpp index 8f25bdf5..3b94af8b 100644 --- a/MMF2SDK/VOLINFO/Main.cpp +++ b/MMF2SDK_Unicode/VOLINFO/Main.cpp @@ -38,7 +38,7 @@ short expressionsInfos[]= // ============================================================================ // // CONDITION ROUTINES -// +// // ============================================================================ @@ -47,20 +47,20 @@ short expressionsInfos[]= // ============================================================================ // // EXPRESSIONS ROUTINES -// +// // ============================================================================ long WINAPI DLLExport GetVol(LPRDATA rdPtr,long param1) { long p1 = CNC_GetFirstExpressionParameter(rdPtr, param1, TYPE_STRING); //Reversing the string. - LPSTR buf = (LPSTR)callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE, MAX_PATH , 0); + LPTSTR buf = (LPTSTR)callRunTimeFunction(rdPtr, RFUNCTION_GETSTRINGSPACE, MAX_PATH , 0); buf[0] = '\0'; DWORD w1,w2,w3; - char ignore[10]; + TCHAR ignore[10]; //None of the info is null because sometimes that crashes Win9x machines. - GetVolumeInformation( (LPSTR)p1 , buf , MAX_PATH , &w1 , &w2 , &w3 , ignore , 9 ); - + GetVolumeInformation( (LPTSTR)p1 , buf , MAX_PATH , &w1 , &w2 , &w3 , ignore , 9 ); + rdPtr->rHo.hoFlags |= HOF_STRING; return (long)buf; } @@ -74,18 +74,18 @@ long WINAPI DLLExport GetVol(LPRDATA rdPtr,long param1) // Located at the end of the source for convinience // Must finish with a 0 // -long (WINAPI * ConditionJumps[])(LPRDATA rdPtr, long param1, long param2) = - { +long (WINAPI * ConditionJumps[])(LPRDATA rdPtr, long param1, long param2) = + { 0 }; - + short (WINAPI * ActionJumps[])(LPRDATA rdPtr, long param1, long param2) = { 0 }; -long (WINAPI * ExpressionJumps[])(LPRDATA rdPtr, long param) = - { +long (WINAPI * ExpressionJumps[])(LPRDATA rdPtr, long param) = + { GetVol, 0 }; \ No newline at end of file diff --git a/MMF2SDK/VOLINFO/Main.h b/MMF2SDK_Unicode/VOLINFO/Main.h similarity index 86% rename from MMF2SDK/VOLINFO/Main.h rename to MMF2SDK_Unicode/VOLINFO/Main.h index 43918d48..821d95c6 100644 --- a/MMF2SDK/VOLINFO/Main.h +++ b/MMF2SDK_Unicode/VOLINFO/Main.h @@ -2,6 +2,14 @@ // and then remove the #pragma message above. If you do not do this, MMF2 // could confuse your object with another in the event editor. +#ifdef _UNICODE + #define EDITDATA EDITDATAW + #define LPEDATA LPEDATAW +#else + #define EDITDATA EDITDATAA + #define LPEDATA LPEDATAA +#endif + // ------------------------------ // DEFINITION OF CONDITIONS CODES // ------------------------------ @@ -20,10 +28,10 @@ #define EXP_EXPRESSION2 0 -#define EXP_LAST 1 +#define EXP_LAST 1 // --------------------- -// OBJECT DATA STRUCTURE +// OBJECT DATA STRUCTURE // --------------------- // Used at edit time and saved in the MFA/CCN/EXE files @@ -48,7 +56,7 @@ typedef EDITDATA * LPEDATA; // Used at runtime. Initialize it in the CreateRunObject function. // Free any allocated memory or object in the DestroyRunObject function. // -// Note: if you store C++ objects in this structure and do not store +// Note: if you store C++ objects in this structure and do not store // them as pointers, you must call yourself their constructor in the // CreateRunObject function and their destructor in the DestroyRunObject // function. As the RUNDATA structure is a simple C structure and not a C++ object. @@ -75,11 +83,11 @@ typedef RUNDATA * LPRDATA; // Default flags - see documentation for more info // ------------- -#define OEFLAGS 0 -#define OEPREFS 0 +#define OEFLAGS 0 +#define OEPREFS 0 // If to handle message, specify the priority of the handling procedure -// 0= low, 255= very high. You should use 100 as normal. +// 0= low, 255= very high. You should use 100 as normal. // -------------------------------------------------------------------- #define WINDOWPROC_PRIORITY 100 diff --git a/MMF2SDK/VOLINFO/Resource.h b/MMF2SDK_Unicode/VOLINFO/Resource.h similarity index 78% rename from MMF2SDK/VOLINFO/Resource.h rename to MMF2SDK_Unicode/VOLINFO/Resource.h index 01025157..8eb5246f 100644 --- a/MMF2SDK/VOLINFO/Resource.h +++ b/MMF2SDK_Unicode/VOLINFO/Resource.h @@ -2,7 +2,7 @@ // App Studio generated include file. // Used by Ext.rc // -#define _APS_NO_MFC 1 +#define _APS_NO_MFC 1 // About box information #define IDST_OBJNAME 128 @@ -12,10 +12,10 @@ #define IDST_HTTP 132 // Dialog Box ID -#define DB_SETUP 20003 +#define DB_SETUP 20003 // Help ID -#define ID_HELP 20004 +#define ID_HELP 20004 // Actions @@ -25,10 +25,10 @@ #define MN_ACTIONS 20000 // Commands of action menu -#define IDMN_ACTION 25000 +#define IDMN_ACTION 25000 // Action strings -#define M_ACTION 5000 +#define M_ACTION 5000 // Titles of action parameters #define M_ACT_P1 5501 @@ -73,13 +73,13 @@ #define M_EXP_P2 7501 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/MMF2SDK/VOLINFO/Runtime.cpp b/MMF2SDK_Unicode/VOLINFO/Runtime.cpp similarity index 86% rename from MMF2SDK/VOLINFO/Runtime.cpp rename to MMF2SDK_Unicode/VOLINFO/Runtime.cpp index 8f3f4a81..36a19b42 100644 --- a/MMF2SDK/VOLINFO/Runtime.cpp +++ b/MMF2SDK_Unicode/VOLINFO/Runtime.cpp @@ -3,7 +3,7 @@ // This file contains routines that are handled during the Runtime. // // Including creating, display, and handling your object. -// +// // ============================================================================ // Common Include @@ -44,7 +44,7 @@ WORD DebugTree[]= // GetRunObjectDataSize // -------------------- // Returns the size of the runtime datazone of the object -// +// ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) { return(sizeof(RUNDATA)); @@ -55,15 +55,15 @@ ushort WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) // CreateRunObject // --------------- // The routine where the object is actually created -// +// short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) { /* - This routine runs when your object is created, as you might have guessed. - It is here that you must transfer any data you need in rdPtr from edPtr, - because after this has finished you cannot access it again! - Also, if you have anything to initialise (e.g. dynamic arrays, surface objects) - you should do it here, and free your resources in DestroyRunObject. + This routine runs when your object is created, as you might have guessed. + It is here that you must transfer any data you need in rdPtr from edPtr, + because after this has finished you cannot access it again! + Also, if you have anything to initialise (e.g. dynamic arrays, surface objects) + you should do it here, and free your resources in DestroyRunObject. */ // No errors return 0; @@ -74,12 +74,12 @@ short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPt // DestroyRunObject // ---------------- // Destroys the run-time object -// +// short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) { /* - When your object is destroyed (either with a Destroy action or at the end of - the frame) this routine is called. You must free any resources you have allocated! + When your object is destroyed (either with a Destroy action or at the end of + the frame) this routine is called. You must free any resources you have allocated! */ // No errors return 0; @@ -90,38 +90,38 @@ short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) // HandleRunObject // ---------------- // Called (if you want) each loop, this routine makes the object live -// +// short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) { /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : + If your extension will draw to the MMF window you should first + check if anything about its display has changed : - if (rdPtr->roc.rcChanged) - return REFLAG_DISPLAY; - else - return 0; + if (rdPtr->roc.rcChanged) + return REFLAG_DISPLAY; + else + return 0; - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF loop use : - If your extension won't draw to the window, but it still needs - to do something every MMF loop use : + return 0; - return 0; + If you don't need to do something every loop, use : - If you don't need to do something every loop, use : + return REFLAG_ONESHOT; - return REFLAG_ONESHOT; + This doesn't mean this function can never run again. If you want MMF + to handle your object again (causing this code to run) use this function: - This doesn't mean this function can never run again. If you want MMF - to handle your object again (causing this code to run) use this function: + callRun-timeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); - callRun-timeFunction(rdPtr, RFUNCTION_REHANDLE, 0, 0); - - At the end of the loop this code will run + At the end of the loop this code will run */ - // Will not be called next loop + // Will not be called next loop return REFLAG_ONESHOT; } @@ -129,11 +129,11 @@ short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) // DisplayRunObject // ---------------- // Draw the object in the application screen. -// +// short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) { /* - If you return REFLAG_DISPLAY in HandleRunObject this routine will run. + If you return REFLAG_DISPLAY in HandleRunObject this routine will run. */ // Ok return 0; @@ -147,7 +147,7 @@ short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) // in DisplayRunObject too, but this is automatically done if you implement // GetRunObjectSurface (MMF applies the ink effect to the surface). // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. /* cSurface* WINAPI DLLExport GetRunObjectSurface(LPRDATA rdPtr) @@ -164,7 +164,7 @@ cSurface* WINAPI DLLExport GetRunObjectSurface(LPRDATA rdPtr) // // Should return NULL if the object is not transparent. // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. // /* @@ -208,7 +208,7 @@ LPSMASK WINAPI DLLExport GetRunObjectCollisionMask(LPRDATA rdPtr, LPARAM lParam) // PauseRunObject // ---------------- // Enters the pause mode -// +// short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) { // Ok @@ -231,7 +231,7 @@ short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) // ============================================================================ // // START APP / END APP / START FRAME / END FRAME routines -// +// // ============================================================================ // ------------------- @@ -239,7 +239,7 @@ short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) // ------------------- // Called when the application starts or restarts. // Useful for storing global data -// +// void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) { // Example @@ -257,7 +257,7 @@ void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) // EndApp // ------------------- // Called when the application ends. -// +// void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) { // Example @@ -275,7 +275,7 @@ void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) // StartFrame // ------------------- // Called when the frame starts or restarts. -// +// void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) { } @@ -284,7 +284,7 @@ void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) // EndFrame // ------------------- // Called when the frame ends. -// +// void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) { } @@ -292,17 +292,17 @@ void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) // ============================================================================ // // TEXT ROUTINES (if OEFLAG_TEXT) -// +// // ============================================================================ // ------------------- // GetRunObjectFont // ------------------- // Return the font used by the object. -// +// /* - // Note: do not forget to enable the functions in the .def file + // Note: do not forget to enable the functions in the .def file // if you remove the comments below. void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) @@ -316,7 +316,7 @@ void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) // SetRunObjectFont // ------------------- // Change the font used by the object. -// +// void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) { // Example @@ -336,7 +336,7 @@ void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) // GetRunObjectTextColor // --------------------- // Return the text color of the object. -// +// COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) { // Example @@ -348,7 +348,7 @@ COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) // SetRunObjectTextColor // --------------------- // Change the text color of the object. -// +// void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) { // Example @@ -364,7 +364,7 @@ void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) // WINDOWPROC (interception of messages sent to hMainWin and hEditWin) // // Do not forget to enable the WindowProc function in the .def file if you implement it -// +// // ============================================================================ /* // Get the pointer to the object's data from its window handle @@ -416,7 +416,7 @@ LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM w // ============================================================================ // // DEBUGGER ROUTINES -// +// // ============================================================================ // ----------------- @@ -438,7 +438,7 @@ LPWORD WINAPI DLLExport GetDebugTree(LPRDATA rdPtr) // ----------------- // This routine returns the text of a given item. // -void WINAPI DLLExport GetDebugItem(LPSTR pBuffer, LPRDATA rdPtr, int id) +void WINAPI DLLExport GetDebugItem(LPTSTR pBuffer, LPRDATA rdPtr, int id) { #if !defined(RUN_ONLY) diff --git a/MMF2SDK/VOLINFO/VOLINFO Example.mfa b/MMF2SDK_Unicode/VOLINFO/VOLINFO Example.mfa similarity index 100% rename from MMF2SDK/VOLINFO/VOLINFO Example.mfa rename to MMF2SDK_Unicode/VOLINFO/VOLINFO Example.mfa diff --git a/MMF2SDK/VOLINFO/res/EXTICON.BMP b/MMF2SDK_Unicode/VOLINFO/res/EXTICON.BMP similarity index 100% rename from MMF2SDK/VOLINFO/res/EXTICON.BMP rename to MMF2SDK_Unicode/VOLINFO/res/EXTICON.BMP diff --git a/MMF2SDK/VOLINFO/res/EXTIMG.BMP b/MMF2SDK_Unicode/VOLINFO/res/EXTIMG.BMP similarity index 100% rename from MMF2SDK/VOLINFO/res/EXTIMG.BMP rename to MMF2SDK_Unicode/VOLINFO/res/EXTIMG.BMP diff --git a/rSDK/Inc/zconf.h b/rSDK/Inc/zconf.h index 5e1d68a0..828ca617 100644 --- a/rSDK/Inc/zconf.h +++ b/rSDK/Inc/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -33,14 +33,21 @@ # ifndef Z_SOLO # define compress z_compress # define compress2 z_compress2 +# define compress_z z_compress_z +# define compress2_z z_compress2_z # define compressBound z_compressBound +# define compressBound_z z_compressBound_z # endif # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound +# define deflateBound_z z_deflateBound_z # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd # define deflateGetDictionary z_deflateGetDictionary @@ -56,6 +63,7 @@ # define deflateSetDictionary z_deflateSetDictionary # define deflateSetHeader z_deflateSetHeader # define deflateTune z_deflateTune +# define deflateUsed z_deflateUsed # define deflate_copyright z_deflate_copyright # define get_crc_table z_get_crc_table # ifndef Z_SOLO @@ -125,9 +133,12 @@ # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table +# define inflate_fixed z_inflate_fixed # ifndef Z_SOLO # define uncompress z_uncompress # define uncompress2 z_uncompress2 +# define uncompress_z z_uncompress_z +# define uncompress2_z z_uncompress2_z # endif # define zError z_zError # ifndef Z_SOLO @@ -231,14 +242,20 @@ # endif #endif -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const +#ifndef z_const +# ifdef ZLIB_CONST +# define z_const const +# else +# define z_const +# endif #endif #ifdef Z_SOLO - typedef unsigned long z_size_t; +# ifdef _WIN64 + typedef unsigned long long z_size_t; +# else + typedef unsigned long z_size_t; +# endif #else # define z_longlong long long # if defined(NO_SIZE_T) @@ -293,14 +310,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have @@ -349,6 +358,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -431,11 +443,11 @@ typedef uLong FAR uLongf; typedef unsigned long z_crc_t; #endif -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */ # define Z_HAVE_STDARG_H #endif @@ -467,11 +479,14 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# if defined(__WATCOMC__) || defined(__GO32__) || \ + (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ @@ -501,17 +516,19 @@ typedef uLong FAR uLongf; #endif #ifndef z_off_t -# define z_off_t long +# define z_off_t long long #endif #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t +#elif defined(__MINGW32__) +# define z_off64_t long long +#elif defined(_WIN32) && !defined(__GNUC__) +# define z_off64_t __int64 +#elif defined(__GO32__) +# define z_off64_t offset_t #else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif +# define z_off64_t z_off_t #endif /* MVS linker does not support external names larger than 8 bytes */ diff --git a/rSDK/Inc/zlib.h b/rSDK/Inc/zlib.h index f09cdaf1..a57d3361 100644 --- a/rSDK/Inc/zlib.h +++ b/rSDK/Inc/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.3.2, February 17th, 2026 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,24 +24,28 @@ The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ #ifndef ZLIB_H #define ZLIB_H -#include "zconf.h" +#ifdef ZLIB_BUILD +# include +#else +# include "zconf.h" +#endif #ifdef __cplusplus extern "C" { #endif -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VERSION "1.3.2" +#define ZLIB_VERNUM 0x1320 #define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_MINOR 3 +#define ZLIB_VER_REVISION 2 #define ZLIB_VER_SUBREVISION 0 /* @@ -78,8 +82,8 @@ extern "C" { even in the case of corrupted input. */ -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); +typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); +typedef void (*free_func)(voidpf opaque, voidpf address); struct internal_state; @@ -217,7 +221,7 @@ typedef gz_header FAR *gz_headerp; /* basic functions */ -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +ZEXTERN const char * ZEXPORT zlibVersion(void); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check @@ -225,12 +229,12 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); */ /* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); +ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. + allocation functions. total_in, total_out, adler, and msg are initialized. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all @@ -247,7 +251,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); */ -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce @@ -276,7 +280,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -320,8 +324,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was @@ -360,7 +364,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); */ -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT deflateEnd(z_streamp strm); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending @@ -375,7 +379,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateInit(z_streamp strm); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by @@ -383,7 +387,8 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); read or consumed. The allocation of a sliding window will be deferred to the first call of inflate (if the decompression does not complete on the first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. + them to use default allocation functions. total_in, total_out, adler, and + msg are initialized. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -397,7 +402,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); */ -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce @@ -440,7 +445,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); The Z_BLOCK option assists in appending to or combining deflate streams. To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if + number of unused bits in the input taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate @@ -517,7 +522,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); */ -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateEnd(z_streamp strm); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending @@ -535,16 +540,15 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); */ /* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); +ZEXTERN int ZEXPORT deflateInit2(z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy); This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. + fields zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. @@ -587,18 +591,21 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. + filter (or predictor), Z_RLE to limit match distances to one (run-length + encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string + matching). Filtered data consists mostly of small values with a somewhat + random distribution, as produced by the PNG filters. In this case, the + compression algorithm is tuned to compress them better. The effect of + Z_FILTERED is to force more Huffman coding and less string matching than the + default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. + Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better + compression for PNG image data than Huffman only. The degree of string + matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then + Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but + never the correctness of the compressed output, even if it is not set + optimally for the given data. Z_FIXED uses the default string matching, but + prevents the use of dynamic Huffman codes, allowing for a simpler decoder + for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid @@ -608,9 +615,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); +ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. When using the zlib format, this @@ -652,16 +659,16 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, not perform any compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); +ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); /* Returns the sliding dictionary being maintained by deflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -674,8 +681,8 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, stream state is inconsistent. */ -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); +ZEXTERN int ZEXPORT deflateCopy(z_streamp dest, + z_streamp source); /* Sets the destination stream as a complete copy of the source stream. @@ -692,31 +699,32 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, destination. */ -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +ZEXTERN int ZEXPORT deflateReset(z_streamp strm); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate the internal compression state. The stream will leave the compression level and any other attributes that may have been - set unchanged. + set unchanged. total_in, total_out, adler, and msg are initialized. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); +ZEXTERN int ZEXPORT deflateParams(z_streamp strm, + int level, + int strategy); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2(). This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not @@ -729,7 +737,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, Then no more input data should be provided before the deflateParams() call. If this is done, the old level and strategy will be applied to the data compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). + applied to the data compressed after deflateParams(). deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if @@ -740,11 +748,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, retried with more output space. */ -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); +ZEXTERN int ZEXPORT deflateTune(z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for @@ -757,8 +765,8 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); +ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen); +ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or @@ -770,11 +778,14 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, to return Z_STREAM_END. Note that it is possible for the compressed size to be larger than the value returned by deflateBound() if flush options other than Z_FINISH or Z_NO_FLUSH are used. + + delfateBound_z() is the same, but takes and returns a size_t length. Note + that a long is 32 bits on Windows. */ -ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, - unsigned *pending, - int *bits)); +ZEXTERN int ZEXPORT deflatePending(z_streamp strm, + unsigned *pending, + int *bits); /* deflatePending() returns the number of bytes and bits of output that have been generated, but not yet provided in the available output. The bytes not @@ -784,12 +795,27 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, or bits are Z_NULL, then those values are not set. deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. If an int is 16 bits and memLevel is 9, then + it is possible for the number of pending bytes to not fit in an unsigned. In + that case Z_BUF_ERROR is returned and *pending is set to the maximum value + of an unsigned. + */ + +ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, + int *bits); +/* + deflateUsed() returns in *bits the most recent number of deflate bits used + in the last byte when flushing to a byte boundary. The result is in 1..8, or + 0 if there has not yet been a flush. This helps determine the location of + the last bit of a deflate stream. + + deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); +ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, + int bits, + int value); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits @@ -804,8 +830,8 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, source stream state was inconsistent. */ -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); +ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm, + gz_headerp head); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called @@ -821,16 +847,17 @@ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). + the time set to zero, and os set to the current operating system, with no + extra, name, or comment fields. The gzip header is returned to the default + state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); +ZEXTERN int ZEXPORT inflateInit2(z_streamp strm, + int windowBits); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized @@ -865,9 +892,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -881,9 +910,9 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, deferred until inflate() is called. */ -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); +ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm, + const Bytef *dictionary, + uInt dictLength); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, @@ -904,22 +933,22 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, inflate(). */ -ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); +ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm, + Bytef *dictionary, + uInt *dictLength); /* Returns the sliding dictionary being maintained by inflate. dictLength is set to the number of bytes in the dictionary, and that many bytes are copied to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. */ -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateSync(z_streamp strm); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all @@ -932,14 +961,14 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); +ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, + z_streamp source); /* Sets the destination stream as a complete copy of the source stream. @@ -954,18 +983,19 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, destination. */ -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateReset(z_streamp strm); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. + total_in, total_out, adler, and msg are initialized. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); +ZEXTERN int ZEXPORT inflateReset2(z_streamp strm, + int windowBits); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted @@ -978,17 +1008,19 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, the windowBits parameter is invalid. */ -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); +ZEXTERN int ZEXPORT inflatePrime(z_streamp strm, + int bits, + int value); /* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. + This function inserts bits in the inflate input stream. The intent is to + use inflatePrime() to start inflating at a bit position in the middle of a + byte. The provided bits will be used before any bytes are used from + next_in. This function should be used with raw inflate, before the first + inflate() call, after inflateInit2() or inflateReset(). It can also be used + after an inflate() return indicates the end of a deflate block or header + when using Z_BLOCK. bits must be less than or equal to 16, and that many of + the least significant bits of value will be inserted in the input. The + other bits in value can be non-zero, and will be ignored. If bits is negative, then the input stream bit buffer is emptied. Then inflatePrime() can be called again to put bits in the buffer. This is used @@ -996,10 +1028,18 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, to feeding inflate codes. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. + stream state was inconsistent, or if bits is out of range. If inflate was + in the middle of processing a header, trailer, or stored block lengths, then + it is possible for there to be only eight bits available in the bit buffer. + In that case, bits > 8 is considered out of range. However, when used as + outlined above, there will always be 16 bits available in the buffer for + insertion. As noted in its documentation above, inflate records the number + of bits in the bit buffer on return in data_type. 32 minus that is the + number of bits available for insertion. inflatePrime does not update + data_type with the new number of bits in buffer. */ -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +ZEXTERN long ZEXPORT inflateMark(z_streamp strm); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the @@ -1027,8 +1067,8 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); source stream state was inconsistent. */ -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); +ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm, + gz_headerp head); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after @@ -1042,20 +1082,22 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not Z_NULL and the respective field is not - present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. + was valid if done is set to one.) The extra, name, and comment pointers + much each be either Z_NULL or point to space to store that information from + the header. If extra is not Z_NULL, then extra_max contains the maximum + number of bytes that can be written to extra. Once done is true, extra_len + contains the actual extra field length, and extra contains the extra field, + or that field truncated if extra_max is less than extra_len. If name is not + Z_NULL, then up to name_max characters, including the terminating zero, are + written there. If comment is not Z_NULL, then up to comm_max characters, + including the terminating zero, are written there. The application can tell + that the name or comment did not fit in the provided space by the absence of + a terminating zero. If any of extra, name, or comment are not present in + the header, then that field's pointer is set to Z_NULL. This allows the use + of deflateSetHeader() with the returned structure to duplicate the header. + Note that if those fields initially pointed to allocated memory, then the + application will need to save them elsewhere so that they can be eventually + freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header @@ -1068,8 +1110,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, */ /* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); +ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits, + unsigned char FAR *window); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized @@ -1089,13 +1131,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, the version of the header file. */ -typedef unsigned (*in_func) OF((void FAR *, - z_const unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); +typedef unsigned (*in_func)(void FAR *, + z_const unsigned char FAR * FAR *); +typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned); -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); +ZEXTERN int ZEXPORT inflateBack(z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is potentially more efficient than @@ -1163,7 +1205,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, cannot return Z_OK. */ -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm); /* All memory allocated by inflateBackInit() is freed. @@ -1171,7 +1213,7 @@ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); state was inconsistent. */ -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +ZEXTERN uLong ZEXPORT zlibCompileFlags(void); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: @@ -1203,13 +1245,14 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) - The sprintf variant used by gzprintf (zero is best): + The sprintf variant used by gzprintf (all zeros is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + 27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error Remainder: - 27-31: 0 (reserved) + 28-31: 0 (reserved) */ #ifndef Z_SOLO @@ -1221,11 +1264,14 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can be modified if - you need special options. + you need special options. The _z versions of the functions use the size_t + type for lengths. Note that a long is 32 bits on Windows. */ -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); +ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size @@ -1239,9 +1285,12 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, buffer. */ -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); +ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level); +ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen, + int level); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte @@ -1255,22 +1304,25 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, Z_STREAM_ERROR if the level parameter is invalid. */ -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen); +ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); +ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen); +ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t sourceLen); /* Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size + the byte length of the source buffer. On entry, *destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen + mechanism outside the scope of this compression library.) On exit, *destLen is the actual size of the uncompressed data. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not @@ -1280,8 +1332,10 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, buffer with the uncompressed data up to that point. */ -ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong *sourceLen)); +ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen); +ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, + const Bytef *source, z_size_t *sourceLen); /* Same as uncompress, except that sourceLen is a pointer, where the length of the source is *sourceLen. On return, *sourceLen is the number of @@ -1300,22 +1354,26 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode); - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. 'T' cannot be + used to force transparent reading. Transparent reading is automatically + performed if there is no gzip header at the start. Transparent reading can + be disabled with the 'G' option, which will instead return an error if there + is no gzip header. 'N' will open the file in non-blocking mode. - "a" can be used instead of "w" to request that the gzip stream that will - be written be appended to the file. "+" will result in an error, since + 'a' can be used instead of 'w' to request that the gzip stream that will + be written be appended to the file. '+' will result in an error, since reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when + 'x' when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of 'e' when reading or writing will set the flag to close the file on an execve() call. These functions, as well as gzip, will read and decode a sequence of gzip @@ -1334,14 +1392,22 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. + file could not be opened. Note that if 'N' is in mode for non-blocking, the + open() itself can fail in order to not block. In that case gzopen() will + return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can + then be re-tried. If the application would like to block on opening the + file, then it can use open() without O_NONBLOCK, and then gzdopen() with the + resulting file descriptor and 'N' in the mode, which will set it to non- + blocking. */ -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode); /* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. An + 'e' in mode will set fd's flag to close the file on an execve() call. An 'N' + in mode will set fd's non-blocking flag. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor @@ -1360,15 +1426,15 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); will not detect if fd is invalid (unless fd is -1). */ -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size); /* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1376,20 +1442,20 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); too late. */ -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy); /* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, or Z_MEM_ERROR if there is a memory allocation error. */ -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); /* - Reads the given number of uncompressed bytes from the compressed file. If + Read and decompress up to len uncompressed bytes from file into buf. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. @@ -1411,20 +1477,26 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); stream. Alternatively, gzerror can be used before gzclose to detect this case. + gzread can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzread() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. + gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. If len is too large to fit in an int, then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. + Z_STREAM_ERROR. If some data was read before an error, then that data is + returned until exhausted, after which the next call will signal the error. */ -ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, - gzFile file)); +ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, + gzFile file); /* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if @@ -1435,26 +1507,29 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior - is the same as the behavior of fread() implementations in common libraries, - but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + is the same as that of fread() implementations in common libraries. This + could result in data loss if used with size != 1 when reading a concurrently + written file or a non-blocking file. In that case, use size == 1 or gzread() + instead. */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len); /* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written, or 0 in case of error or + if len is 0. If the write destination is non-blocking, then gzwrite() may + return a number of bytes written that is not 0 and less than len. + + If len does not fit in an int, then 0 is returned and nothing is written. */ -ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, - z_size_t nitems, gzFile file)); +ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, + z_size_t nitems, gzFile file); /* - gzfwrite() writes nitems items of size size from buf to file, duplicating + Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. @@ -1463,76 +1538,117 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, if there was an error. If the multiplication of size and nitems overflows, i.e. the product does not fit in a z_size_t, then nothing is written, zero is returned, and the error state is set to Z_STREAM_ERROR. + + If writing a concurrently read file or a non-blocking file with size != 1, + a partial item could be written, with no way of knowing how much of it was + not written, resulting in data loss. In that case, use size == 1 or + gzwrite() instead. */ -ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...); +#else +ZEXTERN int ZEXPORTVA gzprintf(); +#endif /* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). + return an error (0) with nothing written. + + In that last case, there may also be a buffer overflow with unpredictable + consequences, which is possible only if zlib was compiled with the insecure + functions sprintf() or vsprintf(), because the secure snprintf() and + vsnprintf() functions were not available. That would only be the case for + a non-ANSI C compiler. zlib may have been built without gzprintf() because + secure functions were not available and having gzprintf() be insecure was + not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of + these possibilities can be determined using zlibCompileFlags(). + + If a Z_BUF_ERROR is returned, then nothing was written due to a stall on + the non-blocking write destination. */ -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s); /* - Writes the given null-terminated string to the compressed file, excluding + Compress and write the given null-terminated string s to file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. + The number of characters written may be less than the length of the string + if the write destination is non-blocking. + + If the length of the string does not fit in an int, then -1 is returned + and nothing is written. */ -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); /* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. + for end-of-file or in case of error. If some data was read before an error, + then that data is returned until exhausted, after which the next call will + return NULL to signal the error. + + gzgets can be used on a file being concurrently written, and on a non- + blocking device, both as for gzread(). However lines may be broken in the + middle, leaving it up to the application to reassemble them as needed. */ -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +ZEXTERN int ZEXPORT gzputc(gzFile file, int c); /* - Writes c, converted to an unsigned char, into the compressed file. gzputc + Compress and write c, converted to an unsigned char, into file. gzputc returns the value that was written, or -1 in case of error. */ -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +ZEXTERN int ZEXPORT gzgetc(gzFile file); /* - Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. This is implemented as a macro for speed. - As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file - points to has been clobbered or not. + Read and decompress one byte from file. gzgetc returns this byte or -1 in + case of end of file or error. If some data was read before an error, then + that data is returned until exhausted, after which the next call will return + -1 to signal the error. + + This is implemented as a macro for speed. As such, it does not do all of + the checking the other functions do. I.e. it does not check to see if file + is NULL, nor whether the structure file points to has been clobbered or not. + + gzgetc can be used to read a gzip file on a non-blocking device. If the + input stalls and there is no uncompressed data to return, then gzgetc() will + return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be + called again. */ -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); /* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). + + gzungetc(-1, file) will force any pending seek to execute. Then gztell() + will report the position, even if the requested seek reached end of file. + This can be used to determine the number of uncompressed bytes in a gzip + file without having to read it into a buffer. */ -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); /* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new @@ -1544,18 +1660,19 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); */ /* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); +ZEXTERN z_off_t ZEXPORT gzseek(gzFile file, + z_off_t offset, int whence); - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new - starting position. + starting position. For reading or writing, any actual seeking is deferred + until the next read or write operation, or close operation when writing. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in @@ -1563,52 +1680,52 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, would be before the current position. */ -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +ZEXTERN int ZEXPORT gzrewind(gzFile file); /* - Rewinds the given file. This function is supported only for reading. + Rewind file. This function is supported only for reading. - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). */ /* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +ZEXTERN z_off_t ZEXPORT gztell(gzFile file); - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); +ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file); - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. */ -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +ZEXTERN int ZEXPORT gzeof(gzFile file); /* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +ZEXTERN int ZEXPORT gzdirect(gzFile file); /* - Returns true (1) if file is being copied directly while reading, or false + Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input @@ -1616,8 +1733,11 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); If gzdirect() is used immediately after gzopen() or gzdopen() it will cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). If the input is being written concurrently or the device is non- + blocking, then gzdirect() may give a different answer once four bytes of + input have been accumulated, which is what is needed to confirm or deny a + gzip header. Before this, gzdirect() will return true (1). When writing, gzdirect() returns true (1) if transparent writing was requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: @@ -1627,10 +1747,10 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); gzip file reading and decompression, which may not be desired.) */ -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose(gzFile file); /* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. @@ -1640,8 +1760,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); last read ended in the middle of a gzip stream, or Z_OK on success. */ -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_r(gzFile file); +ZEXTERN int ZEXPORT gzclose_w(gzFile file); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to @@ -1652,12 +1772,13 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); zlib library. */ -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum); /* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. + Return the error message for the last error which occurred on file. + If errnum is not NULL, *errnum is set to zlib error number. If an error + occurred in the file system and not in the compression library, *errnum is + set to Z_ERRNO and the application may consult errno to get the exact error + code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is @@ -1668,9 +1789,9 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); functions above that do not distinguish those cases in their return values. */ -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +ZEXTERN void ZEXPORT gzclearerr(gzFile file); /* - Clears the error and end-of-file flags for file. This is analogous to the + Clear the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ @@ -1685,11 +1806,12 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); library. */ -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1704,15 +1826,16 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); if (adler != original_adler) error(); */ -ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); +ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, + z_size_t len); /* - Same as adler32(), but with a size_t length. + Same as adler32(), but with a size_t length. Note that a long is 32 bits + on Windows. */ /* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); +ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, + z_off_t len2); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for @@ -1722,12 +1845,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, negative, the result has no meaning or utility. */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: @@ -1739,20 +1863,35 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); +ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, + z_size_t len); /* - Same as crc32(), but with a size_t length. + Same as crc32(), but with a size_t length. Note that a long is 32 bits on + Windows. */ /* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); +ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative, otherwise zero is returned. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). len2 must be non-negative, otherwise zero is returned. +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. */ @@ -1761,20 +1900,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); +ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateInit_(z_streamp strm, + const char *version, int stream_size); +ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size); +ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, + const char *version, int stream_size); +ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size); #ifdef Z_PREFIX_SET # define z_deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) @@ -1819,7 +1958,7 @@ struct gzFile_s { unsigned char *next; z_off64_t pos; }; -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */ #ifdef Z_PREFIX_SET # undef z_gzgetc # define z_gzgetc(g) \ @@ -1836,12 +1975,13 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ * without large file support, _LFS64_LARGEFILE must also be true */ #ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int); + ZEXTERN z_off64_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) @@ -1852,6 +1992,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 # else # define gzopen gzopen64 # define gzseek gzseek64 @@ -1859,49 +2000,53 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 # endif # ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell64(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t); # endif #else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); + ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int); + ZEXTERN z_off_t ZEXPORT gztell(gzFile); + ZEXTERN z_off_t ZEXPORT gzoffset(gzFile); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); #endif #else /* Z_SOLO */ - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t); + ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t); #endif /* !Z_SOLO */ /* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); -ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); -ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); -ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, - const char *mode)); +ZEXTERN const char * ZEXPORT zError(int); +ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void); +ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int); +ZEXTERN int ZEXPORT inflateValidate(z_streamp, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp); +ZEXTERN int ZEXPORT inflateResetKeep(z_streamp); +ZEXTERN int ZEXPORT deflateResetKeep(z_streamp); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, + const char *mode); #endif #if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, - const char *format, - va_list va)); +ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, + const char *format, + va_list va); # endif #endif diff --git a/rSDK/Lib/zlib.lib b/rSDK/Lib/zlib.lib index 9d76f3d1..5e7f3e34 100644 Binary files a/rSDK/Lib/zlib.lib and b/rSDK/Lib/zlib.lib differ diff --git a/rSDK/ZlibStream/Data.h b/rSDK/ZlibStream/Data.h index 5693c099..b311c7ed 100644 --- a/rSDK/ZlibStream/Data.h +++ b/rSDK/ZlibStream/Data.h @@ -1,6 +1,20 @@ class rRundata; typedef rRundata * LPRRDATA; +#ifdef _UNICODE + #define EDITDATA EDITDATAW + #define LPEDATA LPEDATAW + typedef std::wstring tstring; + typedef std::wstringstream tstringstream; + #define t_gzopen(path, mode) gzopen_w(path, mode) +#else + #define EDITDATA EDITDATAA + #define LPEDATA LPEDATAA + typedef std::string tstring; + typedef std::stringstream tstringstream; + #define t_gzopen(path, mode) gzopen(path, mode) +#endif + // -------------------------------- // RUNNING OBJECT DATA STRUCTURE // -------------------------------- @@ -12,18 +26,18 @@ typedef struct tagRDATA #include "MagicRDATA.h" //bool is volatile so it can be changed instantly by threads - unsigned short inbuffersize; // Default size of memory buffer - double PercentageDifference; // Percentage difference input->output - string LastOutput; // Last finished file name - string returnstring; // String to return with statistics or errors - volatile bool threadsafe; // Ensure only one thread accesses rdPtr's variables + unsigned short inbuffersize; //Default size of memory buffer + double PercentageDifference; //Percentage difference input->output + tstring LastOutput; //Last finished file name + tstring returnstring; //String to return with statistics or errors + volatile bool threadsafe; //Ensure only one thread accesses rdPtr's variables - tagRDATA() : inbuffersize(8192), PercentageDifference(0.0), LastOutput(""), returnstring(""), threadsafe(false) // Constructor + tagRDATA() : inbuffersize(8192), PercentageDifference(0.0), LastOutput(_T("")), returnstring(_T("")), threadsafe(false) //Constructor { //vars initialized above in the initializer list } //functions - ~tagRDATA(){} // Destructor + ~tagRDATA(){} //Destructor } RUNDATA; typedef RUNDATA * LPRDATA; diff --git a/rSDK/ZlibStream/Edittime.cpp b/rSDK/ZlibStream/Edittime.cpp index 32bcc5f9..406fa1fd 100644 --- a/rSDK/ZlibStream/Edittime.cpp +++ b/rSDK/ZlibStream/Edittime.cpp @@ -4,7 +4,7 @@ // under the Frame and Event editors. // // Including creating, display, and setting up your object. -// +// // ============================================================================ #include "common.h" @@ -41,7 +41,7 @@ DEBUGGER_ITEMS_START() // DB_CURRENTSTRING, // DB_CURRENTSTRING|DB_EDITABLE, - // DB_CURRENTVALUE|DB_EDITABLE, + // DB_CURRENTVALUE|DB_EDITABLE, // DB_CURRENTCHECK, // DB_CURRENTCOMBO, @@ -202,23 +202,23 @@ void WINAPI DLLExport SetPropValue(LPMV mV, LPEDATA edPtr, UINT nPropID, LPVOID // // or have an adaptive size of structure like below // // // If the length is different -// if (strlen(pStr)!=strlen(edPtr->text)) +// if (_tcslen(pStr)!=_tcslen(edPtr->text)) // { // // Asks MMF to reallocate the structure with the new size -// LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+strlen(pStr)); -// +// LPEDATA pNewPtr = (LPEDATA)mvReAllocEditData(mV, edPtr, sizeof(EDITDATA)+_tcslen(pStr)); +// // // If reallocation worked // if (pNewPtr!=NULL) // { // // Copy the string // edPtr=pNewPtr; -// strcpy(edPtr->text, pStr); +// _tcscpy(edPtr->text, pStr); // } // } // else -// { +// { // // Same size : simply copy -// strcpy(edPtr->text, pStr); +// _tcscpy(edPtr->text, pStr); // } // } // break; @@ -303,7 +303,7 @@ BOOL WINAPI IsPropEnabled(LPMV mV, LPEDATA edPtr, UINT nPropID) // ============================================================================ // // TEXT PROPERTIES -// +// // ============================================================================ // -------------------- @@ -324,7 +324,7 @@ DWORD WINAPI DLLExport GetTextCaps(mv _far *mV, LPEDATA edPtr) // Note: the pStyle and cbSize parameters are obsolete and passed for compatibility reasons only. // -BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPSTR pStyle, UINT cbSize) +BOOL WINAPI DLLExport GetTextFont(mv _far *mV, LPEDATA edPtr, LPLOGFONT plf, LPTSTR pStyle, UINT cbSize) { #if !RUN_ONLY // Example: copy LOGFONT structure from EDITDATA @@ -482,7 +482,7 @@ WORD BmpToImg(int bmID, npAppli idApp, short HotX = 0, short HotY = 0, short Act // ============================================================================ // // ROUTINES USED UNDER FRAME EDITOR -// +// // ============================================================================ // -------------------- @@ -497,7 +497,7 @@ WORD BmpToImg(int bmID, npAppli idApp, short HotX = 0, short HotY = 0, short Act // /* -int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) +int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPTSTR lpName, fpObjInfo oiPtr, LPEDATA edPtr ) { int error = -1; #ifndef RUN_ONLY @@ -512,7 +512,7 @@ int WINAPI DLLExport MakeIconEx ( mv _far *mV, cSurface* pIconSf, LPSTR lpName, // -------------------- // CreateObject // -------------------- -// Called when you choose "Create new object". It should display the setup box +// Called when you choose "Create new object". It should display the setup box // and initialize everything in the datazone. int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) @@ -521,7 +521,7 @@ int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) // Do some rSDK stuff #include "rCreateObject.h" - + // Set default object settings // edPtr->swidth = 32; @@ -545,7 +545,7 @@ int WINAPI DLLExport CreateObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr) BOOL WINAPI EditObject (mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr, LPEDATA edPtr) { #ifndef RUN_ONLY - + return TRUE; #endif // !RUN_ONLY @@ -594,7 +594,7 @@ void WINAPI DLLExport RemoveObject(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, u { #ifndef RUN_ONLY // Is the last object removed? - if (0 == cpt) + if (0 == cpt) { // Do whatever necessary to remove our data } @@ -676,7 +676,7 @@ void WINAPI DLLExport EditorDisplay(mv _far *mV, fpObjInfo oiPtr, fpLevObj loPtr // IsTransparent // -------------------- // This routine tells MMF2 if the mouse pointer is over a transparent zone of the object. -// +// extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPEDATA edPtr, int dx, int dy) { @@ -690,7 +690,7 @@ extern "C" BOOL WINAPI DLLExport IsTransparent(mv _far *mV, fpLevObj loPtr, LPED // PrepareToWriteObject // -------------------- // Just before writing the datazone when saving the application, MMF2 calls this routine. -// +// void WINAPI DLLExport PrepareToWriteObject(mv _far *mV, LPEDATA edPtr, fpObjInfo adoi) { @@ -725,23 +725,23 @@ BOOL WINAPI GetFilters(LPMV mV, LPEDATA edPtr, DWORD dwFlags, LPVOID pReserved) // Return TRUE if you can create an object from the given file // -BOOL WINAPI DLLExport UsesFile (LPMV mV, LPSTR fileName) +BOOL WINAPI DLLExport UsesFile (LPMV mV, LPTSTR fileName) { BOOL r = FALSE; #ifndef RUN_ONLY // Example: return TRUE if file extension is ".txt" -/* - LPSTR ext, npath; +/* + LPTSTR ext, npath; if ( fileName != NULL ) { - if ( (ext=(LPSTR)malloc(_MAX_EXT)) != NULL ) + if ( (ext=(LPTSTR)malloc(_MAX_EXT)) != NULL ) { - if ( (npath=(LPSTR)malloc(_MAX_PATH)) != NULL ) + if ( (npath=(LPTSTR)malloc(_MAX_PATH)) != NULL ) { - strcpy(npath, fileName); - _splitpath(npath, NULL, NULL, NULL, ext); + _tcscpy(npath, fileName); + _tsplitpath(npath, NULL, NULL, NULL, ext); if ( _stricmp(ext, ".txt") == 0 ) r = TRUE; free(npath); @@ -760,7 +760,7 @@ BOOL WINAPI DLLExport UsesFile (LPMV mV, LPSTR fileName) // Creates a new object from file // -void WINAPI DLLExport CreateFromFile (LPMV mV, LPSTR fileName, LPEDATA edPtr) +void WINAPI DLLExport CreateFromFile (LPMV mV, LPTSTR fileName, LPEDATA edPtr) { #ifndef RUN_ONLY // Initialize your extension data from the given file @@ -768,7 +768,7 @@ void WINAPI DLLExport CreateFromFile (LPMV mV, LPSTR fileName, LPEDATA edPtr) // edPtr->sheight = 32; // Example: store the filename - // strcpy(edPtr->myFileName, fileName); + // _tcscpy(edPtr->myFileName, fileName); #endif // !RUN_ONLY } @@ -778,24 +778,24 @@ void WINAPI DLLExport CreateFromFile (LPMV mV, LPSTR fileName, LPEDATA edPtr) // // ROUTINES USED UNDER EVENT / TIME / STEP-THROUGH EDITOR // You should not need to change these routines -// +// // ============================================================================ // ----------------- // menucpy // ----------------- // Internal routine used later, copy one menu onto another -// -#ifndef RUN_ONLY + void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) { - int n, id, nMn; - TCHAR * strBuf; - HMENU hSubMenu; - +#ifndef RUN_ONLY + int n, id, nMn; + LPTSTR strBuf; + HMENU hSubMenu; + nMn = GetMenuItemCount(hSourceMenu); - strBuf = (TCHAR *)LocalAlloc(LPTR, 80); - for (n=0; n < nMn; n++) + strBuf = (LPTSTR)calloc(80, sizeof(TCHAR)); + for (n = 0; n < nMn; n++) { if (0 == (id = GetMenuItemID(hSourceMenu, n))) AppendMenu(hTargetMenu, MF_SEPARATOR, 0, 0L); @@ -812,26 +812,31 @@ void menucpy(HMENU hTargetMenu, HMENU hSourceMenu) } } } - LocalFree((HLOCAL)strBuf); + free(strBuf); +#endif } // ----------------- // GetPopupMenu // ----------------- // Internal routine used later. Returns the first popup from a menu -// +// HMENU GetPopupMenu(LPEDATA edPtr,short mn) { +#ifndef RUN_ONLY HMENU hPopup = CreatePopupMenu(); if (mn == MN_CONDITIONS) - menucpy(hPopup, ConditionMenu(edPtr)); + menucpy(hPopup,ConditionMenu(/*edPtr*/)); else if (mn == MN_ACTIONS) - menucpy(hPopup, ActionMenu(edPtr)); + menucpy(hPopup,ActionMenu(/*edPtr*/)); else if (mn == MN_EXPRESSIONS) - menucpy(hPopup, ExpressionMenu(edPtr)); + menucpy(hPopup,ExpressionMenu(/*edPtr*/)); return hPopup; +#else + return NULL; +#endif } // -------------------- @@ -842,14 +847,13 @@ HMENU GetPopupMenu(LPEDATA edPtr,short mn) // static LPEVENTINFOS2 GetEventInformations(LPEVENTINFOS2 eiPtr, short code) + { while (eiPtr->infos.code != code) eiPtr = EVINFO2_NEXT(eiPtr); - + return eiPtr; } -#endif // !RUN_ONLY - // ---------------------------------------------------- // GetConditionMenu / GetActionMenu / GetExpressionMenu @@ -862,7 +866,7 @@ HMENU WINAPI DLLExport GetConditionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA ed { #ifndef RUN_ONLY // Check compatibility - return GetPopupMenu(edPtr, MN_CONDITIONS); + return GetPopupMenu(edPtr,MN_CONDITIONS); #endif // !RUN_ONLY return NULL; } @@ -871,7 +875,7 @@ HMENU WINAPI DLLExport GetActionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA edPtr { #ifndef RUN_ONLY // Check compatibility - return GetPopupMenu(edPtr, MN_ACTIONS); + return GetPopupMenu(edPtr,MN_ACTIONS); #endif // !RUN_ONLY return NULL; } @@ -880,7 +884,7 @@ HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA e { #ifndef RUN_ONLY // Check compatibility - return GetPopupMenu(edPtr, MN_EXPRESSIONS); + return GetPopupMenu(edPtr,MN_EXPRESSIONS); #endif // !RUN_ONLY return NULL; } @@ -897,42 +901,37 @@ HMENU WINAPI DLLExport GetExpressionMenu(mv _far *mV, fpObjInfo oiPtr, LPEDATA e #ifndef RUN_ONLY void GetCodeTitle(LPEVENTINFOS2 eiPtr, short code, short param, short mn, LPTSTR strBuf, WORD maxLen) { - HMENU hMn; + HMENU hMn; // Finds event in array - eiPtr = GetEventInformations(eiPtr, code); + eiPtr=GetEventInformations(eiPtr, code); // If a special string is to be returned short strID = EVINFO2_PARAMTITLE(eiPtr, param); - if (strID) - { - switch(mn) - { + if (strID) { + switch(mn) { case MN_CONDITIONS: - if (code >= 0 && code < (short)Conditions.size()) { - if (param >= 0 && param < (short)Conditions[code]->getParamCount()) - _tcscpy_s(strBuf, maxLen, Conditions[code]->getParamName(param)); + if (code>=0&&code<(short)Conditions.size()) { + if (param>=0&¶m<(short)Conditions[code]->getParamCount()) + _tcscpy(strBuf,Conditions[code]->getParamName(param)); } break; case MN_ACTIONS: - if (code >= 0 && code < (short)Actions.size()) { - if (param >= 0 && param < (short)Actions[code]->getParamCount()) - _tcscpy_s(strBuf, maxLen, Actions[code]->getParamName(param)); + if (code>=0&&code<(short)Actions.size()) { + if (param>=0&¶m<(short)Actions[code]->getParamCount()) + _tcscpy(strBuf,Actions[code]->getParamName(param)); } break; case MN_EXPRESSIONS: - if (code >= 0 && code < (short)Expressions.size()) { - if (param >= 0 && param < (short)Expressions[code]->getParamCount()) - _tcscpy_s(strBuf, maxLen, Expressions[code]->getParamName(param)); + if (code>=0&&code<(short)Expressions.size()) { + if (param>=0&¶m<(short)Expressions[code]->getParamCount()) + _tcscpy(strBuf,Expressions[code]->getParamName(param)); } break; } - } - else - { - if ((hMn = LoadMenu(hInstLib, MAKEINTRESOURCE(mn)))) - { + } else { + if ((hMn=LoadMenu(hInstLib, MAKEINTRESOURCE(mn)))) { GetMenuString(hMn, eiPtr->menu, strBuf, maxLen, MF_BYCOMMAND); DestroyMenu(hMn); } @@ -964,9 +963,9 @@ short WINAPI DLLExport GetConditionCodeFromMenu(mv _far *mV, short menuId) #ifndef RUN_ONLY LPEVENTINFOS2 eiPtr; int n; - for (n = Conditions.size(), eiPtr = (LPEVENTINFOS2)conditionsInfos; n > 0 && eiPtr->menu != menuId; n--) - eiPtr = EVINFO2_NEXT(eiPtr); - if (n > 0) + for (n=Conditions.size(),eiPtr=(LPEVENTINFOS2)conditionsInfos;n>0&&eiPtr->menu!=menuId;n--) + eiPtr=EVINFO2_NEXT(eiPtr); + if (n>0) return eiPtr->infos.code; #endif // !RUN_ONLY return -1; @@ -978,9 +977,9 @@ short WINAPI DLLExport GetActionCodeFromMenu(mv _far *mV, short menuId) LPEVENTINFOS2 eiPtr; int n; - for (n = Actions.size(), eiPtr = (LPEVENTINFOS2)actionsInfos; n > 0 && eiPtr->menu != menuId; n--) + for (n=Actions.size(),eiPtr=(LPEVENTINFOS2)actionsInfos;n>0&&eiPtr->menu!=menuId;n--) eiPtr = EVINFO2_NEXT(eiPtr); - if (n > 0) + if (n>0) return eiPtr->infos.code; #endif // !RUN_ONLY return -1; @@ -991,9 +990,9 @@ short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) #ifndef RUN_ONLY LPEVENTINFOS2 eiPtr; int n; - for (n = Expressions.size(), eiPtr = (LPEVENTINFOS2)expressionsInfos; n > 0 && eiPtr->menu != menuId; n--) + for (n=Expressions.size(),eiPtr=(LPEVENTINFOS2)expressionsInfos;n>0&&eiPtr->menu!=menuId;n--) eiPtr = EVINFO2_NEXT(eiPtr); - if (n > 0) + if (n>0) return eiPtr->infos.code; #endif // !RUN_ONLY return -1; @@ -1003,8 +1002,8 @@ short WINAPI DLLExport GetExpressionCodeFromMenu(mv _far *mV, short menuId) // ------------------------------------------------------- // GetConditionInfos / GetActionInfos / GetExpressionInfos // ------------------------------------------------------- -// From a action / condition / expression code, returns -// an infosEvents structure. +// From a action / condition / expression code, returns +// an infosEvents structure. // LPINFOEVENTSV2 WINAPI DLLExport GetConditionInfos(mv _far *mV, short code) @@ -1038,31 +1037,31 @@ LPINFOEVENTSV2 WINAPI DLLExport GetExpressionInfos(mv _far *mV, short code) // ---------------------------------------------------------- // GetConditionString / GetActionString / GetExpressionString // ---------------------------------------------------------- -// From a action / condition / expression code, returns +// From a action / condition / expression code, returns // the string to use for displaying it under the event editor // void WINAPI DLLExport GetConditionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY - if (code >= 0 && code < (short)Conditions.size()) - _tcscpy(strPtr, Conditions[code]->getName()); + if (code>=0&&code<(short)Conditions.size()) + _tcscpy(strPtr,Conditions[code]->getName()); #endif // !RUN_ONLY } void WINAPI DLLExport GetActionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY - if (code >= 0 && code < (short)Actions.size()) - _tcscpy(strPtr, Actions[code]->getName()); + if (code>=0&&code<(short)Actions.size()) + _tcscpy(strPtr,Actions[code]->getName()); #endif // !RUN_ONLY } void WINAPI DLLExport GetExpressionString(mv _far *mV, short code, LPTSTR strPtr, short maxLen) { #ifndef RUN_ONLY - if (code >= 0 && code < (short)Expressions.size()) - _tcscpy_s(strPtr, maxLen, Expressions[code]->getName()); + if (code>=0&&code<(short)Expressions.size()) + _tcscpy(strPtr,Expressions[code]->getName()); #endif // !RUN_ONLY } @@ -1076,9 +1075,9 @@ void WINAPI DLLExport GetExpressionParam(mv _far *mV, short code, short param, L { #ifndef RUN_ONLY if (_tcslen(Expressions[code]->getParamName(param))) - _tcscpy_s(strBuf, maxLen, Expressions[code]->getParamName(param)); + _tcscpy(strBuf,Expressions[code]->getParamName(param)); else - *strBuf = 0; + *strBuf=0; #endif } @@ -1097,8 +1096,8 @@ void WINAPI InitParameter(mv _far *mV, short code, paramExt* pExt) #if !RUN_ONLY // Example // ------- - // strcpy(&pExt->pextData[0], "Parameter Test"); - // pExt->pextSize = sizeof(paramExt) + strlen(pExt->pextData) + 1; + // _tcscpy(&pExt->pextData[0], "Parameter Test"); + // pExt->pextSize = sizeof(paramExt) + _tcslen(pExt->pextData)+1; #endif // !RUN_ONLY } @@ -1116,7 +1115,7 @@ BOOL CALLBACK DLLExport SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM // Save edptr SetWindowLong(hDlg, DWL_USER, lParam); - pExt = (paramExt *)lParam; + pExt=(paramExt*)lParam; SetDlgItemText(hDlg, IDC_EDIT, pExt->pextData); return TRUE; @@ -1130,7 +1129,7 @@ BOOL CALLBACK DLLExport SetupProc(HWND hDlg, UINT msgType, WPARAM wParam, LPARAM { case IDOK: // Exit GetDlgItemText(hDlg, IDC_EDIT, pExt->pextData, 500); - pExt->pextSize = sizeof(paramExt) + strlen(pExt->pextData) + 1; + pExt->pextSize=sizeof(paramExt)+_tcslen(pExt->pextData)+1; EndDialog(hDlg, TRUE); return TRUE; @@ -1170,7 +1169,7 @@ void WINAPI EditParameter(mv _far *mV, short code, paramExt* pExt) // Initialize the parameter. // -void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pDest, short size) +void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPTSTR pDest, short size) { #if !RUN_ONLY @@ -1190,14 +1189,14 @@ void WINAPI GetParameterString(mv _far *mV, short code, paramExt* pExt, LPSTR pD // Note: ObjComment is also displayed in the Quick Description box in the Insert Object dialog box // -void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPSTR ObjName, LPSTR ObjAuthor, LPSTR ObjCopyright, LPSTR ObjComment, LPSTR ObjHttp) +void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPTSTR ObjName, LPTSTR ObjAuthor, LPTSTR ObjCopyright, LPTSTR ObjComment, LPTSTR ObjHttp) { #ifndef RUN_ONLY - strcpy_s(ObjName, 255, ObjectName); - strcpy_s(ObjAuthor, 255, ObjectAuthor); - strcpy_s(ObjCopyright, 255, ObjectCopyright); - strcpy_s(ObjComment, 1023, ObjectComment); - strcpy_s(ObjHttp, 255, ObjectURL); + _tcscpy(ObjName, ObjectName); + _tcscpy(ObjAuthor,ObjectAuthor); + _tcscpy(ObjCopyright,ObjectCopyright); + _tcscpy(ObjComment,ObjectComment); + _tcscpy(ObjHttp,ObjectURL); #endif } @@ -1207,10 +1206,10 @@ void WINAPI DLLExport GetObjInfos (mv _far *mV, LPEDATA edPtr, LPSTR ObjName, LP // Returns the help filename of the object. // -LPCSTR WINAPI GetHelpFileName() +LPCTSTR WINAPI GetHelpFileName() { #ifndef RUN_ONLY - return ObjectHelp; + return _T(ObjectHelp); #else return NULL; #endif diff --git a/rSDK/ZlibStream/Ext.rc b/rSDK/ZlibStream/Ext.rc index 9f122903..1da7c4ee 100644 --- a/rSDK/ZlibStream/Ext.rc +++ b/rSDK/ZlibStream/Ext.rc @@ -68,16 +68,16 @@ END #if defined(APSTUDIO_INVOKED) || defined(EDITOR) #if defined(APSTUDIO_INVOKED) -EXO_ICON$(EDITOR) BITMAP "EXTICON.BMP" +EXO_ICON$(EDITOR) BITMAP "Icon.bmp" #else -EXO_ICON BITMAP "EXTICON.BMP" +EXO_ICON BITMAP "Icon.bmp" #endif #endif #if defined(APSTUDIO_INVOKED) || defined(EDITOR) #if defined(APSTUDIO_INVOKED) -EXO_IMAGE$(EDITOR) BITMAP "EXTIMG.BMP" +EXO_IMAGE$(EDITOR) BITMAP "Img.bmp" #else -EXO_IMAGE BITMAP "EXTIMG.BMP" +EXO_IMAGE BITMAP "Img.bmp" #endif #endif diff --git a/rSDK/ZlibStream/General.cpp b/rSDK/ZlibStream/General.cpp index 4e2113c6..6b47b6f3 100644 --- a/rSDK/ZlibStream/General.cpp +++ b/rSDK/ZlibStream/General.cpp @@ -1,7 +1,7 @@ /// ===================================================================================== // // The following routines are used internally by MMF, and should not need to be modified -// +// // ===================================================================================== #include "common.h" @@ -12,7 +12,7 @@ EXT_INIT() // ============================================================================ // // LIBRARY ENTRY & QUIT POINTS -// +// // ============================================================================ // ----------------- @@ -27,16 +27,16 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) conditionsInfos = getConditionInfos(); actionsInfos = getActionInfos(); expressionsInfos = getExpressionInfos(); - + ConditionJumps = getConditions(); ActionJumps = getActions(); ExpressionJumps = getExpressions(); - + switch (dwReason) { // DLL is attaching to the address space of the current process. case DLL_PROCESS_ATTACH: - + hInstLib = hDLL; // Store HINSTANCE break; @@ -49,10 +49,10 @@ BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) break; // The calling process is detaching the DLL from its address space. - case DLL_PROCESS_DETACH: + case DLL_PROCESS_DETACH: break; } - + return TRUE; } @@ -73,7 +73,7 @@ extern "C" int WINAPI DLLExport Initialize(mv _far *mV, int quiet) // ----------------- // Where you want to kill and initialized data opened in the above routine // Called just before freeing the DLL. -// +// extern "C" int WINAPI DLLExport Free(mv _far *mV) { // No error @@ -83,18 +83,18 @@ extern "C" int WINAPI DLLExport Free(mv _far *mV) // ============================================================================ // // GENERAL INFO -// +// // ============================================================================ // ----------------- // Get Infos // ----------------- -// -extern "C" +// +extern "C" { DWORD WINAPI DLLExport GetInfos(int info) { - + switch (info) { case KGI_VERSION: @@ -105,6 +105,12 @@ extern "C" return ForVersion; case KGI_BUILD: return MinimumBuild; + case KGI_UNICODE: + #ifdef _UNICODE + return TRUE; + #else + return FALSE; + #endif default: return 0; } @@ -116,7 +122,7 @@ extern "C" // ---------------------------------------------------------- // Fills an information structure that tells MMF2 everything // about the object, its actions, conditions and expressions -// +// short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) { @@ -129,7 +135,7 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) infoPtr->numOfExpressions = (short)Expressions.size(); infoPtr->editDataSize = sizeof(EDITDATA); - + MagicFlags(infoPtr->editFlags); infoPtr->windowProcPriority = WINDOWPROC_PRIORITY; @@ -138,7 +144,7 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) infoPtr->identifier = IDENTIFIER; infoPtr->version = 1; - + return TRUE; } @@ -150,13 +156,13 @@ short WINAPI DLLExport GetRunObjectInfos(mv _far *mV, fpKpxRunInfos infoPtr) // Data\Runtime folder). // -LPCSTR* WINAPI DLLExport GetDependencies() +LPCTSTR* WINAPI DLLExport GetDependencies() { // Do some rSDK stuff #include "rGetDependencies.h" - - //LPCSTR szDep[] = { - // "MyDll.dll", + + //LPCTSTR szDep[] = { + // _T("MyDll.dll"), // NULL //}; @@ -190,7 +196,7 @@ void WINAPI DLLExport UnloadObject(mv _far *mV, LPEDATA edPtr, int reserved) // -------------------- // For you to update your object structure to newer versions // Called at both edit time and run time -// +// HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr) { // We do nothing here @@ -205,9 +211,10 @@ HGLOBAL WINAPI DLLExport UpdateEditStructure(mv __far *mV, void __far * OldEdPtr // Called at edit time and run time. // // Call lpfnUpdate to update your file pathname (refer to the documentation) -// -void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPSTR, LPSTR)) +// +void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPTSTR appName, LPEDATA edPtr, void (WINAPI * lpfnUpdate)(LPTSTR, LPTSTR)) { + } // --------------------- @@ -216,22 +223,22 @@ void WINAPI DLLExport UpdateFileNames(mv _far *mV, LPSTR appName, LPEDATA edPtr, // // Uncomment this function if you need to store an image in the image bank. // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. // /* int WINAPI DLLExport EnumElts (mv __far *mV, LPEDATA edPtr, ENUMELTPROC enumProc, ENUMELTPROC undoProc, LPARAM lp1, LPARAM lp2) -{ +{ int error = 0; // Replace wImgIdx with the name of the WORD variable you create within the edit structure - - // Enum images + + // Enum images if ( (error = enumProc(&edPtr->wImgIdx, IMG_TAB, lp1, lp2)) != 0 ) { - // Undo enum images - undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); - } + // Undo enum images + undoProc (&edPtr->wImgIdx, IMG_TAB, lp1, lp2); + } return error; } diff --git a/rSDK/ZlibStream/EXTICON.BMP b/rSDK/ZlibStream/Icon.bmp similarity index 100% rename from rSDK/ZlibStream/EXTICON.BMP rename to rSDK/ZlibStream/Icon.bmp diff --git a/rSDK/ZlibStream/EXTIMG.BMP b/rSDK/ZlibStream/Img.bmp similarity index 100% rename from rSDK/ZlibStream/EXTIMG.BMP rename to rSDK/ZlibStream/Img.bmp diff --git a/rSDK/ZlibStream/Information.h b/rSDK/ZlibStream/Information.h index 4c830222..0706502d 100644 --- a/rSDK/ZlibStream/Information.h +++ b/rSDK/ZlibStream/Information.h @@ -3,12 +3,12 @@ // -------------------- // Basic object details -#define ObjectName "ZlibStream object" -#define ObjectAuthor "Darkwire Software" -#define ObjectCopyright "Copyright \xA9 2019 Darkwire Software" -#define ObjectComment "Compress and decompress files with Zlib without loading them into the memory. Allows several actions at once." -#define ObjectURL "http://www.dark-wire.com/" -#define ObjectHelp "Help\\ZlibStream.chm" +#define ObjectName _T("ZlibStream") +#define ObjectAuthor _T("Darkwire Software") +#define ObjectCopyright _T("Copyright \xA9 2011-2026 Darkwire Software") +#define ObjectComment _T("Compress and decompress files with Zlib without loading them into the memory. Allows several actions at once.") +#define ObjectURL _T("http://www.dark-wire.com/") +#define ObjectHelp _T("Help\\ZlibStream.chm") // If you register your object with Clickteam, change this to the ID you were given #define ObjectRegID REGID_PRIVATE diff --git a/rSDK/ZlibStream/Main.cpp b/rSDK/ZlibStream/Main.cpp index 857c206a..8c09820f 100644 --- a/rSDK/ZlibStream/Main.cpp +++ b/rSDK/ZlibStream/Main.cpp @@ -1,7 +1,7 @@ // ============================================================================ // // This file contains the actions, conditions and expressions your object uses -// +// // ============================================================================ #include "Common.h" @@ -12,7 +12,7 @@ { \ Sleep(0); \ } \ - rdPtr -> threadsafe=true + rdPtr -> threadsafe=true #define ThreadSafe_End() rdPtr -> threadsafe=false //Macro for simplicity #define Terminate() \ @@ -21,13 +21,13 @@ rdPtr -> LastOutput = outfilename; \ rdPtr -> rRd -> CallEvent(1); \ ThreadSafe_End(); \ - return 1 + return 1 // Please note: Using GenerateEvent in place of PushEvent is not a good idea, being that // access to rdPtr is blocked by ThreadSafe_Start. Example code: -// ThreadSafe_Start(); -// rdPtr -> GenerateEvent(0); -// ThreadSafe_End(); +// ThreadSafe_Start(); +// rdPtr -> GenerateEvent(0); +// ThreadSafe_End(); // If the user retrieves expressions with GenerateEvent, the ThreadSafe_End is not run // until after they retrieve the variables. So of course the while loop in ThreadSafe_Start // runs without stopping. @@ -39,401 +39,416 @@ //Define struct used to export data from actions to threads struct Params { - char para_infilename [MAX_PATH]; // Input file name - char para_outfilename [MAX_PATH]; // Output file name - bool para_UseAppend; // If true, append; otherwise (over)write output - LPRDATA para_rdPtr; //rdPtr (must be given or threads cannot access rdPtr) + TCHAR para_infilename [MAX_PATH]; //Input file name + TCHAR para_outfilename [MAX_PATH]; //Output file name + bool para_UseAppend; //If true, append; otherwise (over)write output + LPRDATA para_rdPtr; //rdPtr (must be given or threads cannot access rdPtr) }; //Calculate file size -unsigned long file_size(char *filename) { - FILE *pFile = NULL; - if (fopen_s(&pFile, filename, "rb")) // Open file - return 0; // If handle has a problem, return 0, eg no file - fseek(pFile, 0, SEEK_END); // If not, goto end of file - unsigned long size = ftell(pFile); //Get position (Must be stored so fclose can be run) - fclose(pFile); // Close file - return size; // Return +unsigned long file_size(TCHAR *filename) { + FILE *pFile = NULL; + if (_tfopen_s(&pFile, filename, _T("rb"))) // Open file + return 0; // If handle has a problem, return 0, eg no file + fseek(pFile, 0, SEEK_END); //If not, goto end of file + unsigned long size = ftell(pFile); //Get position (Must be stored so fclose can be run) + fclose(pFile); //Close file + return size; //Return } -bool FileSizeCheck(char *infilename, LPRDATA rdPtr) +bool FileSizeCheck(TCHAR *infilename, LPRDATA rdPtr) { - if (file_size(infilename) < 1) - { - ThreadSafe_Start(); - rdPtr -> returnstring = "Input file size 0 or nonexistent."; - ThreadSafe_End(); - return true; - } - else - return false; + if (file_size(infilename) < 1) + { + ThreadSafe_Start(); + rdPtr -> returnstring = _T("Input file size 0 or nonexistent."); + ThreadSafe_End(); + return true; + } + else + return false; } bool HandleCheck(FILE *file, gzFile gzfile, LPRDATA rdPtr) { - if (!file) - { - ThreadSafe_Start(); - rdPtr -> returnstring = "Input file malfunctioned."; - gzclose(gzfile); - ThreadSafe_End(); - return true; - } - else if (!gzfile) - { - ThreadSafe_Start(); - rdPtr -> returnstring = "Output file malfunctioned."; - fclose(file); - ThreadSafe_End(); - return true; - } - else - { - return false; - } + if (!file) + { + ThreadSafe_Start(); + rdPtr -> returnstring = _T("Input file malfunctioned."); + gzclose(gzfile); + ThreadSafe_End(); + return true; + } + else if (!gzfile) + { + ThreadSafe_Start(); + rdPtr -> returnstring = _T("Output file malfunctioned."); + fclose(file); + ThreadSafe_End(); + return true; + } + else + { + return false; + } } //Compress a file DWORD WINAPI compress_one_file(Params *pDataArray) -{ - //Open struct and set variables - char *infilename = new char [MAX_PATH]; // Get input file name - strcpy_s(infilename, MAX_PATH, pDataArray -> para_infilename); - char *outfilename = new char [MAX_PATH]; // Get output file name - strcpy_s(outfilename, MAX_PATH, pDataArray -> para_outfilename); - bool UseAppend = pDataArray -> para_UseAppend; // G et whether to append or write - LPRDATA rdPtr = pDataArray -> para_rdPtr; //Get rdPtr - delete pDataArray; // Container is expendable - - char * WriteType = "wb9"; //User is using write (overwriting) - if (UseAppend) WriteType = "ab9"; // User is using append - +{ + //Open struct and set variables + TCHAR *infilename = new TCHAR [MAX_PATH]; //Get input file name + _tcscpy_s(infilename, MAX_PATH, pDataArray -> para_infilename); + TCHAR *outfilename = new TCHAR [MAX_PATH]; //Get output file name + _tcscpy_s(outfilename, MAX_PATH, pDataArray -> para_outfilename); + bool UseAppend = pDataArray -> para_UseAppend; //G et whether to append or write + LPRDATA rdPtr = pDataArray -> para_rdPtr; //Get rdPtr + delete pDataArray; //Container is expendable + + const char * WriteType = "wb9"; //User is using write (overwriting) + if (UseAppend) WriteType = "ab9"; //User is using append + //Check input file size - no handles to close - if (FileSizeCheck(infilename, rdPtr)) {Terminate();} + if (FileSizeCheck(infilename, rdPtr)) {Terminate();} - //Open handles to both files - FILE *infile = fopen(infilename, "rb"); // r = read, b = binary - gzFile outfile = gzopen(outfilename, WriteType); // a = append (or w=write), b = binary, 9 = max compression + //Open handles to both files + FILE *infile = _tfopen(infilename, _T("rb")); //r = read, b = binary + //gzFile outfile = gzopen(outfilename, WriteType); //a = append (or w=write), b = binary, 9 = max compression + gzFile outfile = t_gzopen(outfilename, WriteType); + //Check handles - HandleCheck() automatically closes handles if invalid - if (HandleCheck(infile, outfile, rdPtr)) {Terminate();} + if (HandleCheck(infile, outfile, rdPtr)) {Terminate();} - //Declare variables - unsigned long PreviousOutputSize = 0; // For calculation purposes - signed int num_read = 0; - unsigned long total_read = 0; - ThreadSafe_Start(); - unsigned short tempinbuffersize = rdPtr -> inbuffersize; - ThreadSafe_End(); + //Declare variables + unsigned long PreviousOutputSize = 0; //For calculation purposes + signed int num_read = 0; + unsigned long total_read = 0; + ThreadSafe_Start(); + unsigned short tempinbuffersize = rdPtr -> inbuffersize; + ThreadSafe_End(); //If using Write, output size should not be included in the calculation later. Otherwise: - if (UseAppend) PreviousOutputSize = file_size(outfilename); - - //This makes sure that the buffer is the right size - if too large, set buffer smaller - if ( file_size(infilename) < tempinbuffersize) - tempinbuffersize = (unsigned short)file_size(infilename); - - //Then declare final variable, the buffer - char *inbuffer = new char[tempinbuffersize]; - - //Iteration through the files - while ((num_read = fread(inbuffer, 1, tempinbuffersize, infile)) > 0) - { - total_read += num_read; - gzwrite(outfile, inbuffer, num_read); - } - - //Close thread - fclose(infile); - gzclose(outfile); - delete[] inbuffer, infilename, outfilename; + if (UseAppend) PreviousOutputSize = file_size(outfilename); + + //This makes sure that the buffer is the right size - if too large, set buffer smaller + if ( file_size(infilename) < tempinbuffersize) + tempinbuffersize = (unsigned short)file_size(infilename); + + //Then declare final variable, the buffer + char *inbuffer = new char[tempinbuffersize]; + + //Iteration through the files + while ((num_read = fread(inbuffer, 1, tempinbuffersize, infile)) > 0) + { + total_read += num_read; + gzwrite(outfile, inbuffer, num_read); + } + + //Close thread + fclose(infile); + gzclose(outfile); + delete[] inbuffer, infilename, outfilename; + //delete[] inbuffer; + //delete[] infilename; + //delete[] outfilename; //Set variables afnter completion - ThreadSafe_Start(); + ThreadSafe_Start(); unsigned long saveoutfilesize = file_size(outfilename); unsigned long saveinfilesize = file_size(infilename); - rdPtr -> PercentageDifference = ((file_size(outfilename)-PreviousOutputSize)*(1.0/file_size(infilename)))*100.0; - - stringstream temp; - temp <<"Buffer used: " - << tempinbuffersize - <<", total bytes read: " - << file_size(infilename) - <<", total bytes written: " - << file_size(outfilename)-PreviousOutputSize - <<", compression rate: " - << rdPtr -> PercentageDifference - <<"%."; - rdPtr -> returnstring = temp.str(); - temp.flush(); - rdPtr -> LastOutput = outfilename; - rdPtr -> rRd -> PushEvent(0); - ThreadSafe_End(); - return 0; + rdPtr -> PercentageDifference = ((file_size(outfilename)-PreviousOutputSize)*(1.0/file_size(infilename)))*100.0; + + tstringstream temp; + temp << _T("Buffer used: ") + << tempinbuffersize + << _T(", total bytes read: ") + << file_size(infilename) + << _T(", total bytes written: ") + << file_size(outfilename)-PreviousOutputSize + << _T(", compression rate: ") + << rdPtr -> PercentageDifference + << _T("%."); + rdPtr -> returnstring = temp.str(); + temp.flush(); + //temp.str(_T("")); + //temp.clear(); + rdPtr -> LastOutput = outfilename; + rdPtr -> rRd -> PushEvent(0); + ThreadSafe_End(); + return 0; } //Decompress a file DWORD WINAPI decompress_one_file(Params *pDataArray) -{ - //Open struct and set variables - char *infilename = new char [MAX_PATH]; // Get input file name - strcpy_s(infilename, MAX_PATH, pDataArray -> para_infilename); - char *outfilename = new char [MAX_PATH]; // Get output file name - strcpy_s(outfilename, MAX_PATH, pDataArray -> para_outfilename); - bool UseAppend = pDataArray -> para_UseAppend; // Get whether to append or write - LPRDATA rdPtr = pDataArray -> para_rdPtr; //Get rdPtr - delete pDataArray; // Container is expendable - - char * WriteType = "wb"; //User is using write (overwriting) - if (UseAppend) WriteType = "ab"; // User is using append - - if (FileSizeCheck(infilename, rdPtr)) {Terminate();} - //Open handles to both files - gzFile infile = gzopen(infilename, "rb"); // r = read, b = binary - FILE *outfile = fopen(outfilename, WriteType); // a = append or w = write, b = binary - - if (HandleCheck(outfile, infile, rdPtr)) {Terminate();} - //Declare variables - unsigned long PreviousOutputSize = 0; // For calculation purposes - int num_read = 0; - unsigned long total_read = 0; - ThreadSafe_Start(); - unsigned short tempinbuffersize = rdPtr -> inbuffersize; - ThreadSafe_End(); - +{ + //Open struct and set variables + TCHAR *infilename = new TCHAR [MAX_PATH]; //Get input file name + _tcscpy_s(infilename, MAX_PATH, pDataArray -> para_infilename); + TCHAR *outfilename = new TCHAR [MAX_PATH]; //Get output file name + _tcscpy_s(outfilename, MAX_PATH, pDataArray -> para_outfilename); + bool UseAppend = pDataArray -> para_UseAppend; //Get whether to append or write + LPRDATA rdPtr = pDataArray -> para_rdPtr; //Get rdPtr + delete pDataArray; //Container is expendable + + TCHAR * WriteType = _T("wb"); //User is using write (overwriting) + if (UseAppend) WriteType = _T("ab"); //User is using append + + if (FileSizeCheck(infilename, rdPtr)) {Terminate();} + //Open handles to both files + //gzFile infile = gzopen(infilename, "rb"); //r = read, b = binary + + gzFile infile = t_gzopen(infilename, "rb"); + + FILE *outfile = _tfopen(outfilename, WriteType); //a = append or w = write, b = binary + + if (HandleCheck(outfile, infile, rdPtr)) {Terminate();} + //Declare variables + unsigned long PreviousOutputSize = 0; //For calculation purposes + int num_read = 0; + unsigned long total_read = 0; + ThreadSafe_Start(); + unsigned short tempinbuffersize = rdPtr -> inbuffersize; + ThreadSafe_End(); + //If using Write, output size should not be included in the calculation later. Otherwise: - if (UseAppend) PreviousOutputSize = file_size(outfilename); - + if (UseAppend) PreviousOutputSize = file_size(outfilename); + //This makes sure that the buffer is the right size - if too large, set buffer smaller - if ( file_size(infilename) < tempinbuffersize) - tempinbuffersize = (unsigned short)file_size(infilename); - - //Then declare final variable, the buffer - char *inbuffer = new char[tempinbuffersize]; - - //Iteration through the files - while ((num_read = gzread(infile, inbuffer, tempinbuffersize)) > 0) - { - total_read += num_read; - fwrite(inbuffer, 1, num_read, outfile); - } - - //Close thread - gzclose(infile); - fclose(outfile); - delete[] inbuffer, infilename, outfilename; - - //Set variables after completion - ThreadSafe_Start(); - rdPtr -> PercentageDifference = ((file_size(outfilename)-PreviousOutputSize)*(1.0/file_size(infilename)))*100.0; - stringstream temp; - temp <<"Buffer used: " - << tempinbuffersize - <<", total bytes read: " - << file_size(infilename) - <<", total bytes written: " - << file_size(outfilename)-PreviousOutputSize - <<", decompression rate: " - << rdPtr -> PercentageDifference - <<"%."; - rdPtr -> returnstring = temp.str(); - temp.flush(); - rdPtr -> LastOutput = outfilename; - rdPtr -> rRd -> CallEvent(0); - ThreadSafe_End(); - return 0; + if ( file_size(infilename) < tempinbuffersize) + tempinbuffersize = (unsigned short)file_size(infilename); + + //Then declare final variable, the buffer + TCHAR *inbuffer = new TCHAR[tempinbuffersize]; + + //Iteration through the files + while ((num_read = gzread(infile, inbuffer, tempinbuffersize)) > 0) + { + total_read += num_read; + fwrite(inbuffer, 1, num_read, outfile); + } + + //Close thread + gzclose(infile); + fclose(outfile); + delete[] inbuffer, infilename, outfilename; + //delete[] inbuffer; + //delete[] infilename; + //delete[] outfilename; + + //Set variables after completion + ThreadSafe_Start(); + rdPtr -> PercentageDifference = ((file_size(outfilename)-PreviousOutputSize)*(1.0/file_size(infilename)))*100.0; + tstringstream temp; + temp <<_T("Buffer used: ") + << tempinbuffersize + << _T(", total bytes read: ") + << file_size(infilename) + << _T(", total bytes written: ") + << file_size(outfilename)-PreviousOutputSize + << _T(", decompression rate: ") + << rdPtr -> PercentageDifference + << _T("%."); + rdPtr -> returnstring = temp.str(); + temp.flush(); + //temp.str(_T("")); + //temp.clear(); + rdPtr -> LastOutput = outfilename; + rdPtr -> rRd -> CallEvent(0); + ThreadSafe_End(); + return 0; } // ============================================================================ // // CONDITIONS -// +// // ============================================================================ CONDITION( - /* ID */ 0, - /* Name */ "%o: On success", - /* Flags */ 0, - /* Params */ (0) + /* ID */ 0, + /* Name */ "%o: On success", + /* Flags */ 0, + /* Params */ (0) ) { - return true; + return true; } CONDITION( - /* ID */ 1, - /* Name */ "%o: On error", - /* Flags */ 0, - /* Params */ (0) + /* ID */ 1, + /* Name */ "%o: On error", + /* Flags */ 0, + /* Params */ (0) ) { - return true; + return true; } // ============================================================================ // // ACTIONS -// +// // ============================================================================ -ACTION( // Old compress function - /* ID */ 0, - /* Name */ "<> Compress a file (%0) --> (%1)", - /* Flags */ 0, - /* Params */ (2, PARAM_STRING, "Input file:", PARAM_STRING, "Output file:") +ACTION( //Old compress function + /* ID */ 0, + /* Name */ "<> Compress a file (%0) --> (%1)", + /* Flags */ 0, + /* Params */ (2, PARAM_STRING, _T("Input file:"), PARAM_STRING, _T("Output file:")) ) { //Old version of compress action: Notify user - MessageBoxA(NULL, "Sorry to interrupt your programming, but you have\nan old \"Compress file\" action in ZlibStream which needs replacing.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in.", "Darkwire Software - Old Event Notice", MB_OK); + MessageBox(NULL, _T("Sorry to interrupt your programming, but you have\nan old \"Compress file\" action in ZlibStream which needs replacing.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in."), _T("Darkwire Software - Old Event Notice"), MB_OK); } -ACTION( // Old decompress function - /* ID */ 1, - /* Name */ "<> Decompress a file (%0) --> (%1)", - /* Flags */ 0, - /* Params */ (2, PARAM_STRING, "Input file:", PARAM_STRING, "Output file:") +ACTION( //Old decompress function + /* ID */ 1, + /* Name */ "<> Decompress a file (%0) --> (%1)", + /* Flags */ 0, + /* Params */ (2, PARAM_STRING, _T("Input file:"), PARAM_STRING, _T("Output file:")) ) { - //Old version of decompress action: Notify user - MessageBoxA(NULL, "Sorry to interrupt your programming, but you have\nan old \"Decompress file\" action in ZlibStream which needs replacing.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in.", "Darkwire Software - Old Event Notice", MB_OK); + //Old version of decompress action: Notify user + MessageBox(NULL, _T("Sorry to interrupt your programming, but you have\nan old \"Decompress file\" action in ZlibStream which needs replacing.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in."), _T("Darkwire Software - Old Event Notice"), MB_OK); } ACTION( - /* ID */ 2, - /* Name */ "Set buffer size to %0 bytes", - /* Flags */ 0, - /* Params */ (1, PARAM_NUMBER, "Buffer size (1 to 16384 bytes):") + /* ID */ 2, + /* Name */ "Set buffer size to %0 bytes", + /* Flags */ 0, + /* Params */ (1, PARAM_NUMBER, _T("Buffer size (1 to 16384 bytes):")) ) { - int p1 = Param(TYPE_INT); - ThreadSafe_Start(); - if (p1 > 0 && p1 < 16385) - rdPtr -> inbuffersize = p1; - else - { - rdPtr -> returnstring = "Buffer is an invalid size. Must be between 0 and 16385 (exclusive)."; - rdPtr -> rRd -> CallEvent(1); - } - ThreadSafe_End(); + int p1 = Param(TYPE_INT); + ThreadSafe_Start(); + if (p1 > 0 && p1 < 16385) + rdPtr -> inbuffersize = p1; + else + { + rdPtr -> returnstring = _T("Buffer is an invalid size. Must be between 0 and 16385 (exclusive)."); + rdPtr -> rRd -> CallEvent(1); + } + ThreadSafe_End(); } ACTION( - /* ID */ 3, - /* Name */ "Compress a file (%0) --> (%1), append = %2", - /* Flags */ 0, - /* Params */ (3, PARAM_STRING, "Input file:", PARAM_STRING, "Output file:", PARAM_NUMBER, "Append if output file already exists? (0 for overwriting, 1 for adding to end)") + /* ID */ 3, + /* Name */ "Compress a file (%0) --> (%1), append = %2", + /* Flags */ 0, + /* Params */ (3, PARAM_STRING, _T("Input file:"), PARAM_STRING, _T("Output file:"), PARAM_NUMBER, _T("Append if output file already exists? (0 for overwriting, 1 for adding to end)")) ) { - //Retrieve variables from parameters - char *p1 = (char *) Param(TYPE_STRING); - char *p2 = (char *) Param(TYPE_STRING); - int p3 = Param(TYPE_INT); - + //Retrieve variables from parameters + TCHAR *p1 = (TCHAR *) Param(TYPE_STRING); + TCHAR *p2 = (TCHAR *) Param(TYPE_STRING); + int p3 = Param(TYPE_INT); + //Set bool for simplicity bool temp = false; if (p3 != 0) temp = true; - //Declare struct and set variables in struct - Params* Parameters = new Params; // Declaration - strcpy_s(Parameters -> para_infilename, MAX_PATH, p1); // Pass the input file name - strcpy_s(Parameters -> para_outfilename, MAX_PATH, p2); // Pass the output file name - Parameters -> para_UseAppend = temp; // Pass the append command - Parameters -> para_rdPtr = rdPtr; // Pass rdPtr - + //Declare struct and set variables in struct + Params* Parameters = new Params; //Declaration + _tcscpy_s(Parameters -> para_infilename, MAX_PATH, p1); //Pass the input file name + _tcscpy_s(Parameters -> para_outfilename, MAX_PATH, p2); //Pass the output file name + Parameters -> para_UseAppend = temp; //Pass the append command + Parameters -> para_rdPtr = rdPtr; //Pass rdPtr + //Create thread - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&compress_one_file, Parameters, 0, NULL); + CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&compress_one_file, Parameters, 0, NULL); } ACTION( - /* ID */ 4, - /* Name */ "Decompress a file (%0) --> (%1), append = %2", - /* Flags */ 0, - /* Params */ (3, PARAM_STRING, "Input file:", PARAM_STRING, "Output file:", PARAM_NUMBER, "Append if output file already exists? (0 for overwriting, 1 for adding to end)") + /* ID */ 4, + /* Name */ "Decompress a file (%0) --> (%1), append = %2", + /* Flags */ 0, + /* Params */ (3, PARAM_STRING, _T("Input file:"), PARAM_STRING, _T("Output file:"), PARAM_NUMBER, _T("Append if output file already exists? (0 for overwriting, 1 for adding to end)")) ) { - //Retrieve variables from parameters - char *p1 = (char *) Param(TYPE_STRING); - char *p2 = (char *) Param(TYPE_STRING); - int p3 = Param(TYPE_INT); - + //Retrieve variables from parameters + TCHAR *p1 = (TCHAR *) Param(TYPE_STRING); + TCHAR *p2 = (TCHAR *) Param(TYPE_STRING); + int p3 = Param(TYPE_INT); + //Set bool for simplicity bool temp = false; if (p3 != 0) temp = true; - //Declare struct and set variables in struct - Params* Parameters = new Params; // Declaration - strcpy_s(Parameters -> para_infilename, MAX_PATH, p1); // Pass the input file name - strcpy_s(Parameters -> para_outfilename, MAX_PATH, p2); // Pass the output file name - Parameters -> para_UseAppend = temp; // Pass the append command - Parameters -> para_rdPtr = rdPtr; // Pass rdPtr - - //Create thread - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&decompress_one_file, Parameters, 0, NULL); + //Declare struct and set variables in struct + Params* Parameters = new Params; //Declaration + _tcscpy_s(Parameters -> para_infilename, MAX_PATH, p1); //Pass the input file name + _tcscpy_s(Parameters -> para_outfilename, MAX_PATH, p2); //Pass the output file name + Parameters -> para_UseAppend = temp; //Pass the append command + Parameters -> para_rdPtr = rdPtr; //Pass rdPtr + + //Create thread + CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&decompress_one_file, Parameters, 0, NULL); } // ============================================================================ // // EXPRESSIONS -// +// // ============================================================================ EXPRESSION( - /* ID */ 0, - /* Name */ "ReturnedCode(", - /* Flags */ 0, - /* Params */ (0) + /* ID */ 0, + /* Name */ "ReturnedCode(", + /* Flags */ 0, + /* Params */ (0) ) { - //Deprecated variable: Notify user - MessageBoxA(NULL, "Sorry to interrupt your programming, but you have\nan old \"ReturnedCode()\" expression from ZlibStream which is removed.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in.", "Darkwire Software - Old Expression Notice", MB_OK); + //Deprecated variable: Notify user + MessageBox(NULL, _T("Sorry to interrupt your programming, but you have\nan old \"ReturnedCode()\" expression from ZlibStream which is removed.\nClick the ZlibStream icon in your event editor to see all the events\nZlibStream is in."), _T("Darkwire Software - Old Expression Notice"), MB_OK); return false; } EXPRESSION( - /* ID */ 1, - /* Name */ "ReturnedString$(", - /* Flags */ EXPFLAG_STRING, - /* Params */ (0) + /* ID */ 1, + /* Name */ "ReturnedString$(", + /* Flags */ EXPFLAG_STRING, + /* Params */ (0) ) { - ThreadSafe_Start(); - string temp = rdPtr -> returnstring; - ThreadSafe_End(); - ReturnStringSafe(temp.c_str()); + ThreadSafe_Start(); + tstring temp = rdPtr -> returnstring; + ThreadSafe_End(); + ReturnStringSafe(temp.c_str()); } EXPRESSION( - /* ID */ 2, - /* Name */ "BufferSize(", - /* Flags */ 0, - /* Params */ (0) + /* ID */ 2, + /* Name */ "BufferSize(", + /* Flags */ 0, + /* Params */ (0) ) { - ThreadSafe_Start(); - unsigned short temp = rdPtr -> inbuffersize; - ThreadSafe_End(); - return temp; + ThreadSafe_Start(); + unsigned short temp = rdPtr -> inbuffersize; + ThreadSafe_End(); + return temp; } EXPRESSION( - /* ID */ 3, - /* Name */ "Percentage(", - /* Flags */ EXPFLAG_DOUBLE, - /* Params */ (0) + /* ID */ 3, + /* Name */ "Percentage(", + /* Flags */ EXPFLAG_DOUBLE, + /* Params */ (0) ) { ThreadSafe_Start(); double temp = rdPtr -> PercentageDifference; - ThreadSafe_End(); + ThreadSafe_End(); //This casts to 2 decimal places - char sprintfdest[20]; - sprintf(sprintfdest,"%.2f", temp); - float temp2 = (float)atof(sprintfdest); + TCHAR sprintfdest[20]; + _stprintf(sprintfdest,_T("%.2f"), temp); + float temp2 = (float)_tstof(sprintfdest); //Voila - ReturnFloat(temp2); + ReturnFloat(temp2); } EXPRESSION( - /* ID */ 4, - /* Name */ "LastOutputFile$(", - /* Flags */ EXPFLAG_STRING, - /* Params */ (0) + /* ID */ 4, + /* Name */ "LastOutputFile$(", + /* Flags */ EXPFLAG_STRING, + /* Params */ (0) ) { - ThreadSafe_Start(); - string temp = rdPtr -> LastOutput; - ThreadSafe_End(); - ReturnStringSafe(temp.c_str()); + ThreadSafe_Start(); + tstring temp = rdPtr -> LastOutput; + ThreadSafe_End(); + ReturnStringSafe(temp.c_str()); } \ No newline at end of file diff --git a/rSDK/ZlibStream/Runtime.cpp b/rSDK/ZlibStream/Runtime.cpp index 97fe6a47..38983111 100644 --- a/rSDK/ZlibStream/Runtime.cpp +++ b/rSDK/ZlibStream/Runtime.cpp @@ -1,7 +1,7 @@ // ============================================================================ // // This file contains routines that are handled during the Runtime -// +// // ============================================================================ // Common Include @@ -10,7 +10,7 @@ // GetRunObjectDataSize // -------------------- // Returns the size of the runtime datazone of the object -// +// short WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) { @@ -22,19 +22,19 @@ short WINAPI DLLExport GetRunObjectDataSize(fprh rhPtr, LPEDATA edPtr) // CreateRunObject // --------------- // The routine where the object is actually created -// +// short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPtr) { // Do some rSDK stuff - new (rdPtr) RUNDATA; // Call rdPtr's Constructor + new (rdPtr) RUNDATA; //Call rdPtr's Constructor #include "rCreateRunObject.h" /* - This routine runs when your object is created, as you might have guessed. - It is here that you must transfer any data you need in rdPtr from edPtr, - because after this has finished you cannot access it again! - Also, if you have anything to initialise (e.g. dynamic arrays, surface objects) - you should do it here, and free your resources in DestroyRunObject. - See Graphic_Object_Ex.txt for an example of what you may put here. + This routine runs when your object is created, as you might have guessed. + It is here that you must transfer any data you need in rdPtr from edPtr, + because after this has finished you cannot access it again! + Also, if you have anything to initialise (e.g. dynamic arrays, surface objects) + you should do it here, and free your resources in DestroyRunObject. + See Graphic_Object_Ex.txt for an example of what you may put here. */ // No errors @@ -46,13 +46,13 @@ short WINAPI DLLExport CreateRunObject(LPRDATA rdPtr, LPEDATA edPtr, fpcob cobPt // DestroyRunObject // ---------------- // Destroys the run-time object -// +// short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) { /* - When your object is destroyed (either with a Destroy action or at the end of - the frame) this routine is called. You must free any resources you have allocated! - See Graphic_Object_Ex.txt for an example of what you may put here. + When your object is destroyed (either with a Destroy action or at the end of + the frame) this routine is called. You must free any resources you have allocated! + See Graphic_Object_Ex.txt for an example of what you may put here. */ // No errors delete rdPtr->rRd; @@ -63,34 +63,34 @@ short WINAPI DLLExport DestroyRunObject(LPRDATA rdPtr, long fast) // HandleRunObject // ---------------- // Called (if you want) each loop, this routine makes the object live -// +// short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) { - //Needs to add fixed value to vector array + //Needs to add fixed value to vector array /* - If your extension will draw to the MMF window you should first - check if anything about its display has changed : + If your extension will draw to the MMF window you should first + check if anything about its display has changed : - return rdPtr->roc.rcChanged?REFLAG_DISPLAY:0; + return rdPtr->roc.rcChanged?REFLAG_DISPLAY:0; - You will also need to make sure you change this flag yourself - to 1 whenever you want to redraw your object - - If your extension won't draw to the window, but it still needs - to do something every MMF loop use : + You will also need to make sure you change this flag yourself + to 1 whenever you want to redraw your object + + If your extension won't draw to the window, but it still needs + to do something every MMF loop use : return 0; - If you don't need to do something every loop, use : + If you don't need to do something every loop, use : return REFLAG_ONESHOT; - This doesn't mean this function can never run again. If you want MMF - to handle your object again (causing this code to run) use this function: + This doesn't mean this function can never run again. If you want MMF + to handle your object again (causing this code to run) use this function: rdPtr->rRd->Rehandle(); - At the end of the loop this code will run + At the end of the loop this code will run */ return 0; } @@ -99,12 +99,12 @@ short WINAPI DLLExport HandleRunObject(LPRDATA rdPtr) // DisplayRunObject // ---------------- // Draw the object in the application screen. -// +// short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) { /* - If you return REFLAG_DISPLAY in HandleRunObject this routine will run. - See Graphic_Object_Ex.txt for an example of what you may put here. + If you return REFLAG_DISPLAY in HandleRunObject this routine will run. + See Graphic_Object_Ex.txt for an example of what you may put here. */ // Ok return 0; @@ -118,7 +118,7 @@ short WINAPI DLLExport DisplayRunObject(LPRDATA rdPtr) // in DisplayRunObject too, but this is automatically done if you implement // GetRunObjectSurface (MMF applies the ink effect to the transition). // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. /* cSurface* WINAPI DLLExport GetRunObjectSurface(LPRDATA rdPtr) @@ -135,7 +135,7 @@ cSurface* WINAPI DLLExport GetRunObjectSurface(LPRDATA rdPtr) // // Should return NULL if the object is not transparent. // -// Note: do not forget to enable the function in the .def file +// Note: do not forget to enable the function in the .def file // if you remove the comments below. // /* @@ -179,7 +179,7 @@ cSurface* WINAPI DLLExport GetRunObjectCollisionMask(LPRDATA rdPtr, LPARAM lPara // PauseRunObject // ---------------- // Enters the pause mode -// +// short WINAPI DLLExport PauseRunObject(LPRDATA rdPtr) { // Ok @@ -202,7 +202,7 @@ short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) // ============================================================================ // // START APP / END APP / START FRAME / END FRAME routines -// +// // ============================================================================ // ------------------- @@ -210,7 +210,7 @@ short WINAPI DLLExport ContinueRunObject(LPRDATA rdPtr) // ------------------- // Called when the application starts or restarts. // Useful for storing global data -// +// void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) { // Example @@ -228,7 +228,7 @@ void WINAPI DLLExport StartApp(mv _far *mV, CRunApp* pApp) // EndApp // ------------------- // Called when the application ends. -// +// void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) { // Example @@ -246,7 +246,7 @@ void WINAPI DLLExport EndApp(mv _far *mV, CRunApp* pApp) // StartFrame // ------------------- // Called when the frame starts or restarts. -// +// void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) { @@ -256,7 +256,7 @@ void WINAPI DLLExport StartFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) // EndFrame // ------------------- // Called when the frame ends. -// +// void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) { @@ -265,17 +265,17 @@ void WINAPI DLLExport EndFrame(mv _far *mV, DWORD dwReserved, int nFrameIndex) // ============================================================================ // // TEXT ROUTINES (if OEFLAG_TEXT) -// +// // ============================================================================ // ------------------- // GetRunObjectFont // ------------------- // Return the font used by the object. -// +// /* - // Note: do not forget to enable the functions in the .def file + // Note: do not forget to enable the functions in the .def file // if you remove the comments below. void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) @@ -289,7 +289,7 @@ void WINAPI GetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf) // SetRunObjectFont // ------------------- // Change the font used by the object. -// +// void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) { // Example @@ -309,7 +309,7 @@ void WINAPI SetRunObjectFont(LPRDATA rdPtr, LOGFONT* pLf, RECT* pRc) // GetRunObjectTextColor // --------------------- // Return the text color of the object. -// +// COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) { // Example @@ -321,7 +321,7 @@ COLORREF WINAPI GetRunObjectTextColor(LPRDATA rdPtr) // SetRunObjectTextColor // --------------------- // Change the text color of the object. -// +// void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) { // Example @@ -335,7 +335,7 @@ void WINAPI SetRunObjectTextColor(LPRDATA rdPtr, COLORREF rgb) // ============================================================================ // // DEBUGGER ROUTINES -// +// // ============================================================================ // ----------------- @@ -357,14 +357,14 @@ LPWORD WINAPI DLLExport GetDebugTree(LPRDATA rdPtr) // ----------------- // This routine returns the text of a given item. // -void WINAPI DLLExport GetDebugItem(LPSTR pBuffer, LPRDATA rdPtr, int id) +void WINAPI DLLExport GetDebugItem(LPTSTR pBuffer, LPRDATA rdPtr, int id) { #if !defined(RUN_ONLY) // Example // ------- /* - char temp[DB_BUFFERSIZE]; + TCHAR temp[DB_BUFFERSIZE]; switch (id) { @@ -410,16 +410,16 @@ void WINAPI DLLExport EditDebugItem(LPRDATA rdPtr, int id) case DB_CURRENTSTRING: { EditDebugInfo dbi; - char buffer[256]; + TCHAR buffer[256]; dbi.pText=buffer; dbi.lText=TEXT_MAX; dbi.pTitle=NULL; - strcpy(buffer, rdPtr->text); + _tcscpy(buffer, rdPtr->text); long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi); if (ret) - strcpy(rdPtr->text, dbi.pText); + _tcscpy(rdPtr->text, dbi.pText); } break; case DB_CURRENTVALUE: diff --git a/rSDK/ZlibStream/UpgradeLog.htm b/rSDK/ZlibStream/UpgradeLog.htm new file mode 100644 index 00000000..3f20e750 Binary files /dev/null and b/rSDK/ZlibStream/UpgradeLog.htm differ diff --git a/rSDK/ZlibStream/UpgradeLog2.htm b/rSDK/ZlibStream/UpgradeLog2.htm new file mode 100644 index 00000000..3f20e750 Binary files /dev/null and b/rSDK/ZlibStream/UpgradeLog2.htm differ