Current News Archived News Search News Discussion Forum Old Forum Install Programs More Downloads... Troubleshooting Source Code Format Specs. Misc. Information Non-SF Stuff Links Small banner for links to this site: |
- No longer attempts to write a larger header than this library supports if the archive says it is larger.
- Various additional optimizations are now enabled in the Visual C++ 2008 DLL project.
diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp
--- a/SFmpqapi.cpp
+++ b/SFmpqapi.cpp
@@ -2036,7 +2036,7 @@ BOOL SFMPQAPI WINAPI MpqAddFileToArchiveEx(MPQHANDLE hMPQ, LPCSTR lpSourceFileNa
mpqOpenArc->lpBlockTable[BlockIndex].dwFlags = dwFlags|MAFA_EXISTS;
DWORD dwFileOffset = mpqOpenArc->lpBlockTable[BlockIndex].dwFileOffset;
SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart,0,FILE_BEGIN);
- WriteFile(mpqOpenArc->hFile,&mpqOpenArc->MpqHeader,mpqOpenArc->MpqHeader.dwHeaderSize,&tsz,0);
+ WriteFile(mpqOpenArc->hFile,&mpqOpenArc->MpqHeader,sizeof(MPQHEADER),&tsz,0);
if (dwFlags & MAFA_ENCRYPT) {
DWORD dwCryptKey;
if (dwFlags&MAFA_ENCRYPT) dwCryptKey = HashString(lpDestFileName,HASH_KEY);
@@ -2381,7 +2381,7 @@ BOOL SFMPQAPI WINAPI MpqAddFileFromBufferEx(MPQHANDLE hMPQ, LPVOID lpBuffer, DWO
mpqOpenArc->lpBlockTable[BlockIndex].dwFlags = dwFlags|MAFA_EXISTS;
DWORD dwFileOffset = mpqOpenArc->lpBlockTable[BlockIndex].dwFileOffset;
SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart,0,FILE_BEGIN);
- WriteFile(mpqOpenArc->hFile,&mpqOpenArc->MpqHeader,mpqOpenArc->MpqHeader.dwHeaderSize,&tsz,0);
+ WriteFile(mpqOpenArc->hFile,&mpqOpenArc->MpqHeader,sizeof(MPQHEADER),&tsz,0);
if (dwFlags & MAFA_ENCRYPT) {
DWORD dwCryptKey;
if (dwFlags&MAFA_ENCRYPT) dwCryptKey = HashString(lpFileName,HASH_KEY);
}
if (i==10000) return FALSE;
}
- DWORD dwLastOffset = mpqOpenArc->MpqHeader.dwHeaderSize,tsz;
+ DWORD dwLastOffset = sizeof(MPQHEADER),tsz;
char *buffer = (char *)SFAlloc(65536);
if (buffer==0) {
CloseHandle(hFile);
SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart+dwLastOffset,0,FILE_BEGIN);
SetEndOfFile(mpqOpenArc->hFile);
SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart,0,FILE_BEGIN);
+ mpqOpenArc->MpqHeader.dwHeaderSize = sizeof(MPQHEADER);
WriteFile(mpqOpenArc->hFile,&mpqOpenArc->MpqHeader,sizeof(MPQHEADER),&tsz,0);
- dwLastOffset = mpqOpenArc->MpqHeader.dwHeaderSize;
+ dwLastOffset = sizeof(MPQHEADER);
ReadSize = 65536;
for (i=dwLastOffset;i<mpqOpenArc->MpqHeader.dwHashTableOffset;i+=65536) {
SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart+i,0,FILE_BEGIN);
diff --git a/SFmpqapi.vcproj b/SFmpqapi.vcproj
--- a/SFmpqapi.vcproj
+++ b/SFmpqapi.vcproj
Version="9.00"
Name="SFmpqapi"
ProjectGUID="{D677FDD7-F14A-403F-8D59-C75D1825260C}"
+ RootNamespace="SFmpqapi"
TargetFrameworkVersion="0"
>
<Platforms>
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
+ WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
<Tool
Name="VCCLCompilerTool"
Optimization="2"
- InlineFunctionExpansion="1"
+ InlineFunctionExpansion="0"
+ FavorSizeOrSpeed="1"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SFMPQAPI_EXPORTS;ZLIB_DLL;BETA"
StringPooling="true"
RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
+ EnableFunctionLevelLinking="false"
PrecompiledHeaderFile=".\Release/SFmpqapi.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\SFmpqapi.def"
ProgramDatabaseFile=".\Release/SFmpq.pdb"
- RandomizedBaseAddress="1"
+ RandomizedBaseAddress="0"
DataExecutionPrevention="0"
ImportLibrary=".\Release/SFmpq.lib"
TargetMachine="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
+ WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
<Tool
Name="VCCLCompilerTool"
Optimization="2"
- InlineFunctionExpansion="1"
+ InlineFunctionExpansion="0"
+ FavorSizeOrSpeed="1"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SFMPQAPI_EXPORTS;ZLIB_DLL"
StringPooling="true"
RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
+ EnableFunctionLevelLinking="false"
PrecompiledHeaderFile=".\Release/SFmpqapi.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
SuppressStartupBanner="true"
ModuleDefinitionFile=".\SFmpqapi.def"
ProgramDatabaseFile=".\Release/SFmpq.pdb"
- RandomizedBaseAddress="1"
+ RandomizedBaseAddress="0"
DataExecutionPrevention="0"
ImportLibrary=".\Release/SFmpq.lib"
TargetMachine="1"
|