Merge tag '11.02'

This commit is contained in:
ChaosMarc 2018-05-22 16:22:51 +02:00
commit 0116cb44b4
No known key found for this signature in database
GPG Key ID: E1116DF82FEF02EC
38 changed files with 838 additions and 772 deletions

View File

@ -7,7 +7,6 @@
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include "VersionInfo.h"
#include <windows.h>
#pragma comment(lib, "Version.Lib")
@ -15,11 +14,15 @@ const char* VersionStrings[16] = { "1.00","1.07","1.08","1.09","1.09b","1.09d","
const char* GetVersionString(int version)
{
if (version < 0 || version >= sizeof(VersionStrings))
return "UNKNOW";
return VersionStrings[version];
}
eGameVersion GetD2Version(LPCVOID pVersionResource)
{
if (!pVersionResource) return UNKNOW;
UINT uLen;
VS_FIXEDFILEINFO* ptFixedFileInfo;
if (!VerQueryValue(pVersionResource, "\\", (LPVOID*)&ptFixedFileInfo, &uLen))
@ -67,19 +70,15 @@ eGameVersion GetD2Version(char* gameExe)
return version;
}
eGameVersion GetD2Version()
eGameVersion GetD2Version(HMODULE hModule)
{
HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION);
if (!hResInfo) return UNKNOW;
HGLOBAL hResData = LoadResource(hModule, hResInfo);
if (!hResData) return UNKNOW;
LPVOID pVersionResource = LockResource(hResData);
//DWORD dwSize = SizeofResource(hInst, hResInfo);
//LPVOID pVersionResource = LocalAlloc(LMEM_FIXED, dwSize);
//CopyMemory(pVersionResource, pRes, dwSize);
eGameVersion version = GetD2Version(pVersionResource);
FreeResource(hResData);
//LocalFree(pVersionResource);
return version;
}

View File

@ -6,6 +6,8 @@
=================================================================*/
#pragma once
#include <windows.h>
enum eGameVersion
{
UNKNOW = -1,
@ -29,6 +31,6 @@ enum eGameVersion
const char* GetVersionString(int version);
eGameVersion GetD2Version(char* gamePath);
eGameVersion GetD2Version();
eGameVersion GetD2Version(HMODULE hModule);
///////////////////////// END OF FILE ///////////////////////

View File

@ -48,6 +48,7 @@ enum UpdateServerConst
US_RENAME,
US_PAGENAME,
US_SET_INDEX,
US_SET_MAIN_INDEX,
US_RESET_INDEX,
US_INSERT_PAGE,
US_DELETE_PAGE,

View File

@ -22,6 +22,8 @@ bool active_savegame=false;
#define MAX_CMD_SIZE 200
const char * CMD_PLAYERS="players set to";
const char * CMD_SAVE="/save";
const char * CMD_SELECTPAGE="/page";
@ -34,6 +36,7 @@ const char * CMD_RENAME_CHAR="/renamechar";
const char * CMD_REPAGE_NAME = "/renamepage";
const char * CMD_SET_INDEX = "/setindex";
const char * CMD_SET_MAIN_INDEX = "/setmainindex";
const char * CMD_RESET_INDEX = "/resetindex";
const char * CMD_INSERT_PAGE = "/insertpage";
const char * CMD_DELETE_PAGE = "/deletepage";
@ -334,6 +337,14 @@ int STDCALL commands (char* ptText)
strncpy(command,ptText,MAX_CMD_SIZE-1);
_strlwr(command);
if (!strncmp(command, CMD_PLAYERS, strlen(CMD_PLAYERS)))
{
int nb = atoi(&command[strlen(CMD_PLAYERS)]);
if (nb > 0 && nb <= 64)
nbPlayersCommand = nb;
return 1;
}
if (!strcmp(command, CMD_SAVE))
{
if (onRealm) return 1;
@ -364,7 +375,7 @@ int STDCALL commands (char* ptText)
if (!strncmp(command, CMD_RENAME_CHAR, strlen(CMD_RENAME_CHAR)))
{
const char* param = &command[strlen(CMD_RENAME_CHAR)];
const char* param = &ptText[strlen(CMD_RENAME_CHAR)];
if (param[0] != ' ')
return 1;
param++;
@ -374,7 +385,7 @@ int STDCALL commands (char* ptText)
if (!strncmp(command, CMD_REPAGE_NAME,strlen(CMD_REPAGE_NAME)))
{
if (!active_multiPageStash) return 1;
char* param = &command[strlen(CMD_REPAGE_NAME)];
char* param = &ptText[strlen(CMD_REPAGE_NAME)];
Stash* ptStash = PCPY->currentStash;
if (!ptStash)
return 0;
@ -408,6 +419,13 @@ int STDCALL commands (char* ptText)
return 0;
}
if (!strcmp(command, CMD_SET_MAIN_INDEX))
{
if (!active_multiPageStash) return 1;
updateServer(US_SET_MAIN_INDEX);
return 0;
}
if (!strcmp(command, CMD_RESET_INDEX))
{
if (!active_multiPageStash) return 1;
@ -426,7 +444,7 @@ int STDCALL commands (char* ptText)
if (!strcmp(command, CMD_DELETE_PAGE))
{
if (!active_multiPageStash) return 1;
if (deleteStash(ptChar))
if (deleteStash(ptChar, true))
updateServer(US_DELETE_PAGE);
return 0;
}
@ -435,6 +453,8 @@ int STDCALL commands (char* ptText)
{
if (!active_multiPageStash) return 1;
int page = atoi(&command[strlen(CMD_SWAP)]) - 1;
if (page < 0 && PCPY->currentStash->nextStash)
page = PCPY->currentStash->nextStash->id;
if (page < 0)
return 1;
updateServer(US_SWAP3 + ((page & 0xFF000000) >> 16));

View File

@ -607,7 +607,7 @@ void setFctAddr(DWORD* addr, HMODULE module, LPCSTR index)
*addr = NULL;
}
bool initD2functions()
void initD2functions()
{
// #define D2S(F, I, R, N, P) N = (F##I)GetProcAddress((HMODULE)offset_##F, (LPCSTR)I);
// #define D2F(F, I, R, N, P) N = (F##I)GetProcAddress((HMODULE)offset_##F, (LPCSTR)I);
@ -956,7 +956,6 @@ bool initD2functions()
shifting.ptSkills = V7(D2Common,CC,CC,A8,A8,A8,A8,A8,A8);
shifting.ptImage = V7(D2Common,04,04,04,08,08,3C,34,34);
shifting.ptFrame = V7(D2Common,08,08,08,44,44,40,00,00);
return true;
}
/*================================= END OF FILE =================================*/

View File

@ -30,100 +30,78 @@
#include "common.h"
int version_SmackW32 = UNKNOW;
int version_D2Common = UNKNOW;
int version_ijl11 = UNKNOW;
int version_D2Gdi = UNKNOW;
int version_D2Win = UNKNOW;
int version_D2sound = UNKNOW;
int version_D2MCPCLI = UNKNOW;
int version_D2Launch = UNKNOW;
int version_D2gfx = UNKNOW;
int version_Game = UNKNOW;
//int version_binkw32 = UNKNOW;
//int version_Bnclient = UNKNOW;
int version_D2Client = UNKNOW;
int version_D2Net = UNKNOW;
int version_D2Lang = UNKNOW;
int version_D2Game = UNKNOW;
int version_D2CMP = UNKNOW;
int version_Bnclient = UNKNOW;
int version_D2Common = UNKNOW;
//int version_D2DDraw = UNKNOW;
//int version_D2Direct3D = UNKNOW;
int version_D2Game = UNKNOW;
//int version_D2Gdi = UNKNOW;
int version_D2gfx = UNKNOW;
//int version_D2Glide = UNKNOW;
int version_D2Lang = UNKNOW;
int version_D2Launch = UNKNOW;
//int version_D2MCPClient = UNKNOW;
//int version_D2Multi = UNKNOW;
int version_D2Net = UNKNOW;
//int version_D2sound = UNKNOW;
int version_D2Win = UNKNOW;
int version_Fog = UNKNOW;
//int version_ijl11 = UNKNOW;
//int version_SmackW32 = UNKNOW;
int version_Storm = UNKNOW;
DWORD offset_SmackW32 = NULL;
DWORD offset_D2Common = NULL;
DWORD offset_ijl11 = NULL;
DWORD offset_D2Gdi = NULL;
DWORD offset_D2Win = NULL;
DWORD offset_D2sound = NULL;
DWORD offset_D2Multi = NULL;
DWORD offset_D2MCPCLI = NULL;
DWORD offset_D2Launch = NULL;
DWORD offset_D2gfx = NULL;
DWORD offset_D2Game = NULL;
DWORD offset_Game = NULL;
//DWORD offset_binkw32 = NULL;
//DWORD offset_Bnclient = NULL;
DWORD offset_D2Client = NULL;
DWORD offset_D2Net = NULL;
DWORD offset_D2Lang = NULL;
DWORD offset_D2CMP = NULL;
DWORD offset_Bnclient = NULL;
DWORD offset_D2Common = NULL;
//DWORD offset_D2DDraw = NULL;
//DWORD offset_D2Direct3D = NULL;
DWORD offset_D2Game = NULL;
//DWORD offset_D2Gdi = NULL;
DWORD offset_D2gfx = NULL;
//DWORD offset_D2Glide = NULL;
DWORD offset_D2Lang = NULL;
DWORD offset_D2Launch = NULL;
//DWORD offset_D2MCPClient = NULL;
//DWORD offset_D2Multi = NULL;
DWORD offset_D2Net = NULL;
//DWORD offset_D2sound = NULL;
DWORD offset_D2Win = NULL;
DWORD offset_Fog = NULL;
//DWORD offset_ijl11 = NULL;
//DWORD offset_SmackW32 = NULL;
DWORD offset_Storm = NULL;
// manque : Game.exe D2DDraw.dll D2Direct3D.dll D2Glide.dll
const char* S_SmackW32 = "SmackW32.dll";
const char* S_D2Common = "D2Common.dll";
const char* S_ijl11 = "ijl11.dll";
const char* S_D2Gdi = "D2Gdi.dll";
const char* S_D2Win = "D2Win.dll";
const char* S_D2sound = "D2sound.dll";
const char* S_D2Multi = "D2Multi.dll";
const char* S_D2MCPCLI = "D2MCPClient.dll";
const char* S_D2Launch = "D2Launch.dll";
const char* S_D2gfx = "D2gfx.dll";
const char* S_D2Game = "D2Game.dll";
const char* S_Game = "Game.exe";
//const char* S_binkw32 = "binkw32.dll";
//const char* S_Bnclient = "Bnclient.dll";
const char* S_D2Client = "D2Client.dll";
const char* S_D2Net = "D2Net.dll";
const char* S_D2Lang = "D2Lang.dll";
const char* S_D2CMP = "D2CMP.dll";
const char* S_Bnclient = "Bnclient.dll";
const char* S_D2Common = "D2Common.dll";
//const char* S_D2DDraw = "D2DDraw.dll";
//const char* S_D2Direct3D = "D2Direct3D.dll";
const char* S_D2Game = "D2Game.dll";
//const char* S_D2Gdi = "D2Gdi.dll";
const char* S_D2gfx = "D2gfx.dll";
//const char* S_D2Glide = "D2Glide.dll";
const char* S_D2Lang = "D2Lang.dll";
const char* S_D2Launch = "D2Launch.dll";
//const char* S_D2MCPClient = "D2MCPClient.dll";
//const char* S_D2Multi = "D2Multi.dll";
const char* S_D2Net = "D2Net.dll";
//const char* S_D2sound = "D2sound.dll";
const char* S_D2Win = "D2Win.dll";
const char* S_Fog = "Fog.dll";
//const char* S_ijl11 = "ijl11.dll";
//const char* S_SmackW32 = "SmackW32.dll";
const char* S_Storm = "Storm.dll";
DWORD loadLibrary( const char* libraryName)
{
DWORD offset;
/* char currentpath[MAX_PATH];
if (!strcmp(libraryName,"D2Common.dll") || !strcmp(libraryName,"D2Game.dll") || !strcmp(libraryName,"D2Client.dll"))
{
GetCurrentDirectory(MAX_PATH,currentpath);
strncat(currentpath,"\\",MAX_PATH);
strncat(currentpath,libraryName,MAX_PATH);
log_msg("Load = %s : ",currentpath);
offset = (DWORD)LoadLibrary(currentpath);
log_msg("offset = %08X\n",offset);
if (offset)
{
log_msg("%s loaded successfully at: %08X\n", libraryName, offset);
return offset;
}
}*/
offset = (DWORD)LoadLibrary(libraryName);
if (!offset)
{
log_msg("Failed to load library : %s\n", libraryName);
exit(-1);
}
log_msg("%s loaded successfully at: %08X\n", libraryName, offset);
return offset;
}
void freeLibrary( DWORD library )
{
if (library)
FreeLibrary((HINSTANCE__ *)library);
}
// Change the protection scheme of a loaded
// DLL called libraryName in memory space at address addr+size to allow us to customize it.
void hookLibrary(const char* libraryName, DWORD addr)
@ -152,55 +130,40 @@ void unhookLibrary(const char* libraryName, DWORD addr)
log_msg("%s successfully unhooked. (%08X,%08X)\n", libraryName ,baseOfCode, sizeOfCode);
}
void loadD2Libraries ()
void freeLibrary( DWORD library )
{
log_msg("***** Load D2 Libraries *****\n");
offset_SmackW32 = loadLibrary( S_SmackW32); //0xD000 0x03B90000 Already Loaded -
offset_D2Common = loadLibrary( S_D2Common); //0x8D000 0x037A0000 0x7C000
offset_ijl11 = loadLibrary( S_ijl11); //0x24000 0x60000000 Already Loaded -
offset_D2Gdi = loadLibrary( S_D2Gdi); //0x7000 0x6F830000 Already Loaded -
offset_D2Win = loadLibrary( S_D2Win); //0x19000 0x6F8A0000 Already Loaded 0x1C000
offset_D2sound = loadLibrary( S_D2sound); //0xC000 0x6F980000 Already Loaded 0xD000
// offset_D2Multi = loadLibrary( S_D2Multi); //0x1000 0x6F9A0000 ?
// offset_D2MCPCLI = loadLibrary( S_D2MCPCLI); //0x6000 0x6F9F0000 Already Loaded -
offset_D2Launch = loadLibrary( S_D2Launch); //0x20000 0x6FA10000 Already Loaded 0x1E000
offset_D2gfx = loadLibrary( S_D2gfx); //0xB000 0x6FA70000 Already Loaded -
offset_D2Game = loadLibrary( S_D2Game); //0xF6000 0x6FC30000 0xCF000
offset_D2Client = loadLibrary( S_D2Client); //0xCC000 0x6FAA0000 0xCA000
offset_D2Net = loadLibrary( S_D2Net); //0x6000 0x6FC00000 Already Loaded -
offset_D2Lang = loadLibrary( S_D2Lang); //0x0A000 0x6FC10000 Already Loaded -
offset_D2CMP = loadLibrary( S_D2CMP); //0x18000 0x6FDF0000 Already Loaded 0x19000
offset_Bnclient = loadLibrary( S_Bnclient); //0x15000 0x6FF00000 Already Loaded -
offset_Fog = loadLibrary( S_Fog); //0x20000 0x6FF50000 Already Loaded 0x1F000
offset_Storm = loadLibrary( S_Storm); //0x30000 0x6FFB0000 Already Loaded -
log_msg("\n\n");
if (library && library != offset_Game)
FreeLibrary((HMODULE)library);
}
void freeD2Libraries()
{
if (version_Game >= V114a)
return;
log_msg("***** Free Libraries *****\n");
freeLibrary( offset_SmackW32 );
freeLibrary( offset_D2Common );
freeLibrary( offset_ijl11 );
freeLibrary( offset_D2Gdi );
freeLibrary( offset_D2Win );
freeLibrary( offset_D2sound );
// freeLibrary( offset_D2Multi );
// freeLibrary( offset_D2MCPCLI );
freeLibrary( offset_D2Launch );
freeLibrary( offset_D2gfx );
freeLibrary( offset_D2Game );
// freeLibrary( offset_binkw32 );
// freeLibrary( offset_Bnclient );
freeLibrary( offset_D2Client );
freeLibrary( offset_D2Net );
freeLibrary( offset_D2Lang );
freeLibrary( offset_D2CMP );
freeLibrary( offset_Bnclient );
freeLibrary( offset_D2Common );
// freeLibrary( offset_D2DDraw );
// freeLibrary( offset_D2Direct3D );
freeLibrary( offset_D2Game );
// freeLibrary( offset_D2Gdi );
freeLibrary( offset_D2gfx );
// freeLibrary( offset_D2Glide );
freeLibrary( offset_D2Lang );
freeLibrary( offset_D2Launch );
// freeLibrary( offset_D2MCPClient );
// freeLibrary( offset_D2Multi );
freeLibrary( offset_D2Net );
// freeLibrary( offset_D2sound );
freeLibrary( offset_D2Win );
freeLibrary( offset_Fog );
// freeLibrary( offset_ijl11 );
// freeLibrary( offset_SmackW32 );
freeLibrary( offset_Storm );
log_msg("\n\n");
@ -210,16 +173,17 @@ void hookLibraries()
{
log_msg("***** Unprotect Libraries *****\n");
hookLibrary(S_D2Common, offset_D2Common);
hookLibrary(S_D2Client, offset_D2Client);
hookLibrary(S_D2Lang, offset_D2Lang);
// hookLibrary(S_D2CMP, offset_D2CMP);
hookLibrary(S_D2Common, offset_D2Common);
hookLibrary(S_D2Game, offset_D2Game);
hookLibrary(S_D2gfx, offset_D2gfx);
hookLibrary(S_D2Lang, offset_D2Lang);
hookLibrary(S_D2Launch, offset_D2Launch);
// hookLibrary(S_D2Net, offset_D2Net);
// hookLibrary(S_D2Win, offset_D2Win);
hookLibrary(S_Fog, offset_Fog);
hookLibrary(S_Storm, offset_Storm);
// hookLibrary(S_D2Win, offset_D2Win);
hookLibrary(S_D2Launch, offset_D2Launch);
hookLibrary(S_D2gfx, offset_D2gfx);
// hookLibrary(S_D2Gdi, offset_D2Gdi);
log_msg("\n\n");
}
@ -228,22 +192,26 @@ void unhookLibraries()
{
log_msg("***** Reprotect Libraries *****\n");
unhookLibrary(S_D2Common, offset_D2Common);
unhookLibrary(S_D2Client, offset_D2Client);
unhookLibrary(S_D2Lang, offset_D2Lang);
// unhookLibrary(S_D2CMP, offset_D2CMP);
unhookLibrary(S_D2Common, offset_D2Common);
unhookLibrary(S_D2Game, offset_D2Game);
unhookLibrary(S_D2gfx, offset_D2gfx);
unhookLibrary(S_D2Lang, offset_D2Lang);
unhookLibrary(S_D2Launch, offset_D2Launch);
// unhookLibrary(S_D2Net, offset_D2Net);
// unhookLibrary(S_D2Win, offset_D2Win);
unhookLibrary(S_Fog, offset_Fog);
unhookLibrary(S_Storm, offset_Storm);
// unhookLibrary(S_D2Win, offset_D2Win);
unhookLibrary(S_D2Launch, offset_D2Launch);
unhookLibrary(S_D2gfx, offset_D2gfx);
// unhookLibrary(S_D2Gdi, offset_D2Gdi);
log_msg("\n\n");
}
void freeCustomLibraries()
{
if (!customDlls)
return;
log_msg("***** Free custom libraries *****\n");
TCustomDll* dll=customDlls;
@ -290,15 +258,17 @@ void loadCustomLibraries()
{
if (curString[0])
{
offset_currentDll = loadLibrary(curString);
if (offset_currentDll)
offset_currentDll = (DWORD)LoadLibrary(curString);
if (!offset_currentDll)
{
log_msg("Load library %s failed:\n", curString);
exit(0);
}
nextDll = customDlls;
customDlls = new(TCustomDll);
customDlls->nextDll = nextDll;
customDlls->initialize(offset_currentDll);
}
}
curString=strtok(NULL,"|");
}
}
@ -308,150 +278,131 @@ void loadCustomLibraries()
log_msg("\n\n");
}
/*
void getVersion(DWORD addr, DWORD addr111, int* ver, DWORD v109b, DWORD v109d, DWORD v110, DWORD v111, DWORD v111a, DWORD v111b, DWORD v112, DWORD v113c, DWORD v113d, const char * filename)
void loadLibrary(LPCSTR libName, int* libVersion, DWORD* libOffset, int shift, DWORD v109b, DWORD v109d, DWORD v110, DWORD v111, DWORD v111b, DWORD v112, DWORD v113c)
{
log_msg("version of %s\t",filename);
if (addr==v109b) {
*ver = V109b;
log_msg("1.09b\n");
} else if (addr==v109d) {
*ver = V109d;
log_msg("1.09d\n");
} else if (addr==v110) {
*ver = V110;
log_msg("1.10\n");
} else if ((addr==v111) && (addr111==v111a)) {
*ver = V111;
log_msg("1.11\n");
} else if ((addr==v111) && (addr111==v111b)) {
*ver = V111b;
log_msg("1.11b\n");
} else if (addr==v112) {
*ver = V112;
log_msg("1.12\n");
} else if (addr==v113c) {
*ver = V113c;
log_msg("1.13c\n");
} else if (addr==v113d) {
*ver = V113d;
log_msg("1.13d\n");
} else {
*ver = V113d;
log_msg("unknow, try with 1.13d\n");
*libOffset = (DWORD)LoadLibrary(libName);
if (*libOffset == NULL)
{
log_msg("Failed to load library : %s\n", libName);
exit(-1);
}
log_msg("%s loaded at:\t%08X (", libName, *libOffset);
DWORD addr = *(DWORD*)(*libOffset + shift);
if (version_Game != UNKNOW && (version_Game <= V108 || version_Game >= V113d))
*libVersion = version_Game;
else if (addr==v109b)
*libVersion = V109b;
else if (addr==v109d)
*libVersion = V109d;
else if (addr==v110)
*libVersion = V110;
else if (addr==v111)
*libVersion = V111;
else if (addr==v111b)
*libVersion = V111b;
else if (addr==v112)
*libVersion = V112;
else if (addr==v113c)
*libVersion = V113c;
else {
*libVersion = version_Game != UNKNOW ? version_Game : V113d;
log_msg("unknow, try with ");
}
log_msg("%s)\n", GetVersionString(*libVersion));
}
#define GET_VERSION(F,X,Y,A,B,C,D,E,G,H,I) getVersion(*(DWORD*)(offset_##F + 0x##X), *(DWORD*)(offset_##F + 0x##Y), &version_##F, 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##G, 0x##H, 0x##I, S_##F)
bool initD2version()
#define GET_VERSION(F,S,A,B,C,D,E,G,H) loadLibrary(S_##F, &version_##F, &offset_##F, 0x##S, 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##G, 0x##H)
void initD2modules()
{
log_msg("***** Get dll versions *****\n");
log_msg("***** Get D2 Modules address and version *****\n");
offset_Game = (DWORD)GetModuleHandle(NULL);
version_Game = GetD2Version((HMODULE)offset_Game);
log_msg("Game.exe loaded at:\t%08X (%s)\n", offset_Game, GetVersionString(version_Game));
//GET_VERSION(SmackW32
GET_VERSION(D2Common, 80, 108, B03A26A0, 9E3DE7CC, 0355C185, 8402CA7A, 42E6C2E5, 43028BA5, E58C71DA, 00000000);
//GET_VERSION(ijl11
GET_VERSION(D2Gdi, 80, 108, 90CFD95A, 86CE337B, A8CCC67B, 06059D7D, 42E6C248, 43028B2F, 5D6490A2, 00000000);
GET_VERSION(D2Win, 80, 108, B595A0CD, 1995DAD2, A8F5E2FD, B6DAB75A, 42E6C266, 43028B44, 6AA01FF5, 00000000);
//GET_VERSION(D2sound
//GET_VERSION(D2MCPCLI
GET_VERSION(D2Launch, 80, 100, A66532FF, 66678CC5, 686223E5, 80B0E2C6, 42E6C275, 43028B50, 205A4C0F, 00000000);
GET_VERSION(D2gfx, 80, 110, 00949FA8, 018866A8, 401526B2, 575C8A5E, 42E6C22A, 43028B19, ACBE1B9E, 00000000);
GET_VERSION(D2Client, 80, 108, 03522F39, 6730B639, C9817825, 37EC6E13, 42E6C43F, 43028CA5, 61A3B3D5, 00000000);
GET_VERSION(D2Net, 80, 0F0, E60F4DEA, 940E178B, 890FCC0B, C293A9D5, 42E6C20D, 43028B05, 19FA9F76, 00000000);
GET_VERSION(D2Lang, 80, 0F8, 111DCCB7, 13978953, DF917353, B91BAEA2, 42E6C213, 43028B09, B7B3978E, 00000000);
GET_VERSION(D2Game, 80, 108, B0805792, 8BB2C392, 92FA18E6, 00B6F7B7, 42E6C375, 43028C0D, BD8DD8E5, 00000000);
GET_VERSION(D2CMP, 80, 0F8, BA755486, 9A77DFEE, 38F44382, 4059B13F, 42E6C203, 43028AFE, 33A9427B, 00000000);
//GET_VERSION(Bnclient
GET_VERSION(Fog, 80, 100, 6F16123B, 75990846, 7E7ED3C7, D333B997, 42E6C1F0, 43028AF2, D3BD4F1B, 00000000);
GET_VERSION(Storm, E0, 110, 3B4B41D8, 3B8AB1CE, 00004550, 9C2BECC4, 42E6C1CA, 43028AD9, E4FA2944, 00000000);
if (version_Game >= V114a)
{
// offset_Bnclient = offset_Game; version_Bnclient = version_Game;
offset_D2Client = offset_Game; version_D2Client = version_Game;
offset_D2CMP = offset_Game; version_D2CMP = version_Game;
offset_D2Common = offset_Game; version_D2Common = version_Game;
// offset_D2DDraw = offset_Game; version_D2DDraw = version_Game;
// offset_D2Direct3D = offset_Game; version_D2Direct3D = version_Game;
offset_D2Game = offset_Game; version_D2Game = version_Game;
// offset_D2Gdi = offset_Game; version_D2Gdi = version_Game;
offset_D2gfx = offset_Game; version_D2gfx = version_Game;
// offset_D2Glide = offset_Game; version_D2Glide = version_Game;
offset_D2Lang = offset_Game; version_D2Lang = version_Game;
offset_D2Launch = offset_Game; version_D2Launch = version_Game;
// offset_D2MCPClient = offset_Game; version_D2MCPClient = version_Game;
// offset_D2Multi = offset_Game; version_D2Multi = version_Game;
offset_D2Net = offset_Game; version_D2Net = version_Game;
// offset_D2sound = offset_Game; version_D2sound = version_Game;
offset_D2Win = offset_Game; version_D2Win = version_Game;
offset_Fog = offset_Game; version_Fog = version_Game;
offset_Storm = offset_Game; version_Storm = version_Game;
}
else
{
// GET_VERSION(Bnclient //0x15000 0x6FF00000 Already Loaded -
GET_VERSION(D2Client, 17F, 00000000, 14500000, 12500000, 0D814800, 0D812800, 0DA01000, 0DA03000); //0xCC000 0x6FAA0000 0xCA000
GET_VERSION(D2CMP, 1359, 3C686FE0, 38686FE0, 8BF78B56, 4C880424, 07C71824, CCCCCCCC, C7000005); //0x18000 0x6FDF0000 Already Loaded 0x19000
GET_VERSION(D2Common, 10CA, A1E86FDC, B1E86FDC, 72D03B42, F883057E, 16746AC6, 00FE81C3, 74FE85DB); //0x8D000 0x037A0000 0x7C000
// GET_VERSION(D2DDraw 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //
// GET_VERSION(D2Direct3D 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //
// GET_VERSION(D2Game, 1010, D22A78A1, D22910A1, D43FB0A1, 03E8506F, 53E8506F, 89E8506F, 63E8506F); //0xF6000 0x6FC30000 0xCF000
GET_VERSION(D2Game, 1092, 18968BF1, 38968BF1, 28968BF1, F6335608, C690C5B9, 895FD713, 56535700); //0xF6000 0x6FC30000 0xCF000
// GET_VERSION(D2Gdi, 105, B4000000, 0B210E00, E4000000, 48000401, 2F000401, 00000000, B7000401); //0x7000 0x6F830000 Already Loaded -
GET_VERSION(D2gfx, 10D, EB000000, 006FA700, 00000010, 2A000401, 19000401, 0B210E00, 00000000); //0xB000 0x6FA70000 Already Loaded -
// GET_VERSION(D2Glide 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //
GET_VERSION(D2Lang, 126D, FC45048B, F445048B, 02C18313, C4830000, 00C6E045, 8B48408B, 0C75FF0C); //0x0A000 0x6FC10000 Already Loaded -
GET_VERSION(D2Launch, 109A, 81E8526F, 01E8526F, 85E8526F, 247C8B00, 00FC6583, 15FF0424, E850E045); //0x20000 0x6FA10000 Already Loaded 0x1E000
// GET_VERSION(D2MCPClient 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //0x6000 0x6F9F0000 Already Loaded -
// GET_VERSION(D2Multi 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //0x1000 0x6F9A0000 ?
GET_VERSION(D2Net, 16E1, 78B8A73C, 68B8A73C, 10244C8B, 5349E808, 5EA9E808, 105D8B72, 53B9E808); //0x6000 0x6FC00000 Already Loaded -
// GET_VERSION(D2sound 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //0xC000 0x6F980000 Already Loaded 0xD000
GET_VERSION(D2Win, 1699, 88686F8C, 84686F8C, D094686F, F0030000, 001435E8, 8B088F44, 0013F5E8); //0x19000 0x6F8A0000 Already Loaded 0x1C000
GET_VERSION(Fog, 102, D0000006, 10000001, 00000006, 000042E6, 00004302, 0000483C, 00004B95); //0x20000 0x6FF50000 Already Loaded 0x1F000
GET_VERSION(Storm, 1190, 19E85082, 59E85082, 13C103F6, 0474F685, 8B000321, 3B1074C9, 0D896404); //0x30000 0x6FFB0000 Already Loaded -
if (version_Game == UNKNOW)
version_Game = version_D2gfx;
}
// GET_VERSION(binkw32 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //
// GET_VERSION(ijl11 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //0x24000 0x60000000 Already Loaded -
// GET_VERSION(SmackW32 000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000, 00000000); //0xD000 0x03B90000 Already Loaded -
log_msg("\n\n");
return true;
}
*/
void getVersion(DWORD addr, int* ver, DWORD v109b, DWORD v109d, DWORD v110, DWORD v111, DWORD v111b, DWORD v112, DWORD v113c, int version, const char * filename)
{
log_msg("version of %s\t", filename);
if (version >= V113d) {
*ver = version;
log_msg("%s\n", GetVersionString(version));
} else if (addr==v109b) {
*ver = V109b;
log_msg("1.09b\n");
} else if (addr==v109d) {
*ver = V109d;
log_msg("1.09d\n");
} else if (addr==v110) {
*ver = V110;
log_msg("1.10\n");
} else if (addr==v111) {
*ver = V111;
log_msg("1.11\n");
} else if (addr==v111b) {
*ver = V111b;
log_msg("1.11b\n");
} else if (addr==v112) {
*ver = V112;
log_msg("1.12\n");
} else if (addr==v113c) {
*ver = V113c;
log_msg("1.13c\n");
} else {
*ver = V113d;
log_msg("unknow, try with 1.13d\n");
}
}
#define GET_VERSION(F,X,A,B,C,D,E,G,H,V) getVersion(*(DWORD*)(offset_##F + 0x##X), &version_##F, 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##G, 0x##H, V, S_##F)
bool initD2version()
{
log_msg("***** Get Game.exe version *****\n");
int version = GetD2Version();
log_msg("Game.exe version : %i (%s)\n", version, GetVersionString(version));
log_msg("***** Get dll versions *****\n");
//GET_VERSION(SmackW32
GET_VERSION(D2Common, 10CA, A1E86FDC, B1E86FDC, 72D03B42, F883057E, 16746AC6, 00FE81C3, 74FE85DB, version);
//GET_VERSION(ijl11
GET_VERSION(D2Gdi, 105, B4000000, 0B210E00, E4000000, 48000401, 2F000401, 00000000, B7000401, version);
GET_VERSION(D2Win, 1699, 88686F8C, 84686F8C, D094686F, F0030000, 001435E8, 8B088F44, 0013F5E8, version);
//GET_VERSION(D2sound
//GET_VERSION(D2MCPCLI
GET_VERSION(D2Launch, 109A, 81E8526F, 01E8526F, 85E8526F, 247C8B00, 00FC6583, 15FF0424, E850E045, version);
GET_VERSION(D2gfx, 10D, EB000000, 006FA700, 00000010, 2A000401, 19000401, 0B210E00, 00000000, version);
GET_VERSION(D2Client, 17F, 00000000, 14500000, 12500000, 0D814800, 0D812800, 0DA01000, 0DA03000, version);
GET_VERSION(D2Net, 16E1, 78B8A73C, 68B8A73C, 10244C8B, 5349E808, 5EA9E808, 105D8B72, 53B9E808, version);
GET_VERSION(D2Lang, 126D, FC45048B, F445048B, 02C18313, C4830000, 00C6E045, 8B48408B, 0C75FF0C, version);
// GET_VERSION(D2Game, 1010, D22A78A1, D22910A1, D43FB0A1, 03E8506F, 53E8506F, 89E8506F, 63E8506F, version);
GET_VERSION(D2Game, 1092, 18968BF1, 38968BF1, 28968BF1, F6335608, C690C5B9, 895FD713, 56535700, version);
GET_VERSION(D2CMP, 1359, 3C686FE0, 38686FE0, 8BF78B56, 4C880424, 07C71824, CCCCCCCC, C7000005, version);
//GET_VERSION(Bnclient
GET_VERSION(Fog, 102, D0000006, 10000001, 00000006, 000042E6, 00004302, 0000483C, 00004B95, version);
GET_VERSION(Storm, 1190, 19E85082, 59E85082, 13C103F6, 0474F685, 8B000321, 3B1074C9, 0D896404, version);
log_msg("\n\n");
return true;
}
//////////////////////////////////// EXPORTS FUNCTIONS ////////////////////////////////////
extern "C" __declspec(dllexport) bool __stdcall Release()
{
log_msg("\n***** ENDING DIABLO II *****\n\n" );
freeCustomLibraries();
freeD2Libraries();
return true;
}
extern "C" __declspec(dllexport) void* __stdcall Init(LPSTR IniName)
{
if (IniName) log_msg("* PlugY is called from D2mod.dll\n\n");
else log_msg("* PlugY is called from D2gfx.dll\n\n");
static int isInstalled = false;
if (isInstalled) return NULL;
isInstalled=true;
loadD2Libraries();
initD2modules();
if (!initD2version()) return NULL;
if (version_Game < V109 || version_Game > V113d)
{
log_box("PlugY isn't compatible with this version : %s", GetVersionString(version_Game));
Release();
exit(0);
}
if (!initD2functions()) return NULL;
initD2functions();
loadParameters();
@ -554,15 +505,4 @@ extern "C" __declspec(dllexport) void* __stdcall Init(LPSTR IniName)
return NULL;
}
extern "C" __declspec(dllexport) bool __stdcall Release()
{
log_msg("\n***** ENDING DIABLO II *****\n\n" );
freeCustomLibraries();
freeD2Libraries();
return true;
}
/*================================= END OF FILE =================================*/

View File

@ -26,7 +26,7 @@ void log_initfile()
_getcwd( log_file, MAX_PATH );
if( log_file[strlen(log_file)] != '\\')
strcat(log_file, "\\");
strcat(log_file, LOG_FILE);
strcat(log_file, "PlugY.log");
FILE* lLog = fopen( log_file, "w" );

View File

@ -8,6 +8,7 @@
#include "extendedSaveFile.h"
#include "infinityStash.h"
#include "customLibraries.h"
#include "extraOptions.h"
#include "common.h"
#include <stdio.h>
@ -44,7 +45,7 @@ BYTE * readExtendedSaveFile(char* name, DWORD* size)//WORKS
*size = 14;
*((DWORD*)&data[0]) = FILE_EXTENDED; //"CSTM"
*((WORD *)&data[4]) = FILE_VERSION;
*((DWORD*)&data[6]) = 0;// not used
*((DWORD*)&data[6]) = nbPlayersCommandByDefault - 1;
*((DWORD*)&data[10]) = 0;// number of stash
TCustomDll* currentDll = customDlls;
@ -58,8 +59,6 @@ BYTE * readExtendedSaveFile(char* name, DWORD* size)//WORKS
}
int loadExtendedSaveFile(Unit* ptChar, BYTE data[], DWORD maxSize)//WORKS
{
if (!ptChar || !PCPY || !data) return 0;
@ -81,7 +80,9 @@ int loadExtendedSaveFile(Unit* ptChar, BYTE data[], DWORD maxSize)//WORKS
return 9;
}
curSize += 2;
curSize += 4;
nbPlayersCommand = (*(BYTE*)&data[curSize]) + 1;
curSize += 1;
curSize += 3;
int ret = loadStashList(ptChar, data, maxSize, &curSize, false);
@ -92,6 +93,7 @@ int loadExtendedSaveFile(Unit* ptChar, BYTE data[], DWORD maxSize)//WORKS
currentDll=currentDll->nextDll;
}
PCPY->selfStashIsOpened = true;
return ret;
}
@ -149,7 +151,7 @@ void saveExtendedSaveFile(Unit* ptChar, BYTE** data, DWORD* maxSize, DWORD* curS
*curSize += 4;
*(WORD *)(*data + *curSize) = FILE_VERSION;
*curSize += 2;
*(DWORD *)(*data + *curSize) = 0;
*(DWORD *)(*data + *curSize) = (BYTE)(nbPlayersCommand - 1);
*curSize += 4;
saveStashList(ptChar, PCPY->selfStash, data, maxSize, curSize);

View File

@ -11,6 +11,7 @@
int active_DisplayItemLevel = false;
DWORD nbPlayersCommandByDefault = 0;
DWORD nbPlayersCommand = 0;
int active_alwaysRegenMapInSP = false;
int active_RunLODs = false;
int active_AlwaysDisplayLifeMana = false;
@ -185,15 +186,16 @@ void SendPlayersCommand()
DWORD info = *infoEnabledSendPlayersCommand;
if ((info != 0) && (info != 1) && (info != 6) && (info != 8)) return;
log_msg("SendPlayersCommand %u\n", nbPlayersCommand);
D2SetNbPlayers(nbPlayersCommandByDefault);
D2SetNbPlayers(nbPlayersCommand);
memset(&data,0,sizeof(data));
data.displayType=0x15;
data.un=1;
data.zero=0;//*(BYTE*)(offset_D2Client+0x112CFC); in 1.10
data.null=NULL;
sprintf(data.string, msgNBPlayersString, nbPlayersCommandByDefault);
sprintf(data.string, msgNBPlayersString, nbPlayersCommand);
D2SendMsgToAll((BYTE*)&data);
}

View File

@ -396,9 +396,10 @@ void saveStashList(Unit* ptChar, Stash* ptStash, BYTE** data, DWORD* maxSize, DW
void updateSelectedStashClient(Unit* ptChar)//WORKS
{
Stash* newStash = PCPY->currentStash;
if (!newStash)
return;
updateClient(ptChar, UC_SELECT_STASH, newStash->id, newStash->flags, PCPY->flags);
updateClient(ptChar, UC_PAGE_NAME, newStash->name);
}
void setSelectedStashClient(DWORD stashId, DWORD stashFlags, DWORD flags, bool bOnlyItems)//WORKS
@ -415,8 +416,10 @@ void setSelectedStashClient(DWORD stashId, DWORD stashFlags, DWORD flags, bool b
}
void selectStash(Unit* ptChar, Stash* newStash)//WORKS
void selectStash(Unit* ptChar, Stash* newStash)
{
if (!newStash)
return;
changeToSelectedStash(ptChar, newStash, 0, 0);
updateSelectedStashClient(ptChar);
}
@ -449,7 +452,7 @@ void swapStash(Unit* ptChar, Stash* curStash, Stash* swpStash)
if (!ptChar || !curStash || !swpStash || curStash == swpStash)
return;
changeToSelectedStash(ptChar, swpStash, 1, 0);
updateClient(ptChar, UC_SELECT_STASH, swpStash->id, swpStash->flags | 4, PCPY->flags);
updateClient(ptChar, UC_SELECT_STASH, swpStash->id, swpStash->flags | 8, PCPY->flags);
}
void toggleStash(Unit* ptChar, DWORD page)
@ -478,20 +481,20 @@ void insertStash(Unit* ptChar)
{
Stash* curStash = PCPY->currentStash;
Stash* stash = addStash(ptChar, curStash->isShared);
do
while (stash->previousStash != curStash)
{
stash->flags = stash->previousStash->flags;
stash->name = stash->previousStash->name;
stash->ptListItem = stash->previousStash->ptListItem;
stash = stash->previousStash;
} while (stash != curStash);
}
stash->isIndex = 0;
stash->isMainIndex = 0;
stash->name = NULL;
stash->ptListItem = NULL;
selectNextStash(ptChar);
}
bool deleteStash(Unit* ptChar)
bool deleteStash(Unit* ptChar, bool isClient)
{
if (firstClassicStashItem(ptChar) != NULL)
return false;
@ -500,21 +503,24 @@ bool deleteStash(Unit* ptChar)
if (stash->nextStash == NULL)
{
stash->isIndex = 0;
stash->isMainIndex = 0;
stash->name = NULL;
return true;
}
stash->flags = stash->nextStash->flags;
stash->name = stash->nextStash->name;
if (stash->nextStash->ptListItem != NULL)
swapStash(ptChar, stash, stash->nextStash);
changeToSelectedStash(ptChar, stash->nextStash, 1, isClient);
stash = stash->nextStash;
do {
while (stash->nextStash)
{
stash->flags = stash->nextStash->flags;
stash->name = stash->nextStash->name;
stash->ptListItem = stash->nextStash->ptListItem;
stash = stash->nextStash;
} while (stash->nextStash);
}
stash->isIndex = 0;
stash->isMainIndex = 0;
stash->name = NULL;
stash->ptListItem = NULL;
return true;
@ -543,10 +549,12 @@ void renameCurrentStash(Unit* ptChar, char* name)
}
void setCurrentStashIndex(Unit* ptChar, bool isIndex)
void setCurrentStashIndex(Unit* ptChar, int index)
{
if (PCPY->currentStash)
PCPY->currentStash->isIndex = isIndex;
if (!PCPY->currentStash)
return;
PCPY->currentStash->isIndex = index >= 1;
PCPY->currentStash->isMainIndex = index == 2;
updateSelectedStashClient(ptChar);
}
@ -617,8 +625,15 @@ void selectPreviousIndex2Stash(Unit* ptChar)
{
selectPreviousStash(ptChar);
Stash* selStash = PCPY->currentStash;
while (selStash && !selStash->isMainIndex)
selStash = selStash->previousStash;
if (selStash == NULL)
{
selStash = PCPY->currentStash;
while (selStash->previousStash && ((selStash->id+1) % nbPagesPerIndex2 != 0))
selStash = selStash->previousStash;
}
if (selStash && (selStash != PCPY->currentStash))
selectStash(ptChar, selStash);
@ -649,12 +664,19 @@ void selectNextIndex2Stash(Unit* ptChar)
{
selectNextStash(ptChar);
Stash* selStash = PCPY->currentStash;
while (selStash && !selStash->isMainIndex)
selStash = selStash->nextStash;
if (selStash == NULL)
{
selStash = PCPY->currentStash;
while ((selStash->id+1) % nbPagesPerIndex2 != 0)
{
if (!selStash->isShared && (selStash->id >= maxSelfPages)) break;
if (selStash->isShared && (selStash->id >= maxSharedPages)) break;
selStash = selStash->nextStash ? selStash->nextStash : addStash(ptChar, PCPY->showSharedStash);;
}
}
if (selStash && (selStash != PCPY->currentStash))
selectStash(ptChar, selStash);
}

View File

@ -783,9 +783,9 @@ void init_ExtraOptions(INIFile* iniFile, INIFile* iniFixedFile, INIFile* iniDefa
GET_PRIVATE_PROFILE_STRING(S_EXTRA, S_nbPlayersCommandByDefault, "0");
nbPlayersCommandByDefault = atoi(buffer);
if (version_D2Common == V110)
{if (nbPlayersCommandByDefault > 8) nbPlayersCommandByDefault=8;}
else if (nbPlayersCommandByDefault > 64) nbPlayersCommandByDefault=64;
if (version_D2Common == V109 || version_D2Common == V109b)
{if (nbPlayersCommandByDefault > 64) nbPlayersCommandByDefault=64;}
else if (nbPlayersCommandByDefault > 8) nbPlayersCommandByDefault=8;
log_msg("nbPlayersCommandByDefault\t= %d\n", nbPlayersCommandByDefault);
GET_PRIVATE_PROFILE_STRING(S_EXTRA, S_active_DisplayItemLevel, "0");

View File

@ -72,11 +72,9 @@ void STDCALL updateClientPlayerOnLoading(Unit* ptChar)
log_msg("--- Start updateClientPlayerOnLoading ---\n");
if (PCGame->isLODGame)
{
//selectStash(ptChar, openSharedStashOnLoading ? PCPY->sharedStash : PCPY->selfStash);
if (openSharedStashOnLoading)
toggleToSharedStash(ptChar);
else
toggleToSelfStash(ptChar);
PCPY->showSharedStash = openSharedStashOnLoading;
selectStash(ptChar, openSharedStashOnLoading ? PCPY->sharedStash : PCPY->selfStash);
log_msg("End update client on loading.\n\n");
}
updateClient(ptChar, UC_SHARED_GOLD, PCPY->sharedGold, 0, 0);

Binary file not shown.

Binary file not shown.

View File

@ -159,7 +159,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PlugY.dll&quot;"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PlugY.dll&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>

View File

@ -59,7 +59,7 @@ DWORD FASTCALL handleClientUpdate(DataPacket* packet)
log_msg("[CLIENT] Received custom message: %d with param: %08X , %08X , %08X\n",packet->mFunc,packet->mParam1,packet->mParam2,packet->mParam3);
switch (packet->mFunc)
{
case UC_SELECT_STASH: setSelectedStashClient(packet->mParam1, packet->mParam2, packet->mParam3, (packet->mParam2 & 4) == 4); return 1;
case UC_SELECT_STASH: setSelectedStashClient(packet->mParam1, packet->mParam2, packet->mParam3, (packet->mParam2 & 8) == 8); return 1;
case UC_SHARED_GOLD : updateSharedGold(packet->mParam1); return 1;
case UC_PAGE_NAME: renameCurrentStash(D2GetClientPlayer(), (char*)&packet->mItemID); return 1;
default : return 0;

View File

@ -34,8 +34,9 @@ int STDCALL handleServerUpdate(Unit* ptChar, WORD param)
case US_UNASSIGN_VIT_POINTS : UnassignVitPoints( ptChar ); return 1;
case US_UNASSIGN_SKILLS : UnassignAllSkillsPoints( ptChar ); return 1;
case US_SET_INDEX: setCurrentStashIndex(ptChar, true); return 1;
case US_RESET_INDEX: setCurrentStashIndex(ptChar, false); return 1;
case US_SET_INDEX: setCurrentStashIndex(ptChar, 1); return 1;
case US_SET_MAIN_INDEX: setCurrentStashIndex(ptChar, 2); return 1;
case US_RESET_INDEX: setCurrentStashIndex(ptChar, 0); return 1;
case US_SELECT_PREVIOUS : selectPreviousStash( ptChar ); return 1;
case US_SELECT_NEXT : selectNextStash( ptChar ); return 1;
case US_SELECT_SELF : if (active_sharedStash) toggleToSelfStash( ptChar ); return 1;
@ -46,8 +47,8 @@ int STDCALL handleServerUpdate(Unit* ptChar, WORD param)
case US_SELECT_NEXT2 : selectNext2Stash( ptChar ); return 1;
case US_SELECT_PREVIOUS_INDEX2: selectPreviousIndex2Stash( ptChar ); return 1;
case US_SELECT_NEXT_INDEX2 : selectNextIndex2Stash( ptChar ); return 1;
case US_INSERT_PAGE: insertStash(ptChar); return 1;
case US_DELETE_PAGE: deleteStash(ptChar); return 1;
case US_INSERT_PAGE: insertStash(ptChar); selectNextStash(ptChar); return 1;
case US_DELETE_PAGE: deleteStash(ptChar, false); return 1;
case US_SAVE : savePlayers( ptChar ); return 1;

View File

@ -109,6 +109,6 @@ void __inline fillRect(DWORD x, DWORD y, DWORD Width, DWORD Height, DWORD color,
#define ptClientChar (*ptptClientChar)
//#define CurrentNPCNum (*ptCurrentNPCNum)
bool initD2functions();
void initD2functions();
/*================================= END OF FILE =================================*/

View File

@ -15,41 +15,53 @@ COPYRIGHT
#include <windows.h>
extern int version_SmackW32;
extern int version_D2Common;
extern int version_ijl11;
extern int version_D2Gdi;
extern int version_D2Win;
extern int version_D2sound;
extern int version_D2MCPCLI;
extern int version_D2Launch;
extern int version_D2gfx;
extern int version_Game;
//extern int version_binkw32;
//extern int version_Bnclient;
extern int version_D2Client;
extern int version_D2Net;
extern int version_D2Lang;
extern int version_D2Game;
extern int version_D2CMP;
extern int version_Bnclient;
extern int version_D2Common;
//extern int version_D2DDraw;
//extern int version_D2Direct3D;
extern int version_D2Game;
//extern int version_D2Gdi;
extern int version_D2gfx;
//extern int version_D2Glide;
extern int version_D2Lang;
extern int version_D2Launch;
//extern int version_D2MCPClient;
//extern int version_D2Multi;
extern int version_D2Net;
//extern int version_D2sound;
extern int version_D2Win;
extern int version_Fog;
//extern int version_ijl11;
//extern int version_SmackW32;
extern int version_Storm;
// Address in memory of external DLL
extern DWORD offset_SmackW32;
extern DWORD offset_D2Common;
extern DWORD offset_ijl11;
extern DWORD offset_D2Gdi;
extern DWORD offset_D2Win;
extern DWORD offset_D2sound;
extern DWORD offset_D2MCPCLI;
extern DWORD offset_D2Launch;
extern DWORD offset_D2gfx;
extern DWORD offset_Game;
//extern DWORD offset_binkw32;
//extern DWORD offset_Bnclient;
extern DWORD offset_D2Client;
extern DWORD offset_D2Net;
extern DWORD offset_D2Lang;
extern DWORD offset_D2Game;
extern DWORD offset_D2CMP;
extern DWORD offset_Bnclient;
extern DWORD offset_D2Common;
//extern DWORD offset_D2DDraw;
//extern DWORD offset_D2Direct3D;
extern DWORD offset_D2Game;
//extern DWORD offset_D2Gdi;
extern DWORD offset_D2gfx;
//extern DWORD offset_D2Glide;
extern DWORD offset_D2Lang;
extern DWORD offset_D2Launch;
//extern DWORD offset_D2MCPClient;
//extern DWORD offset_D2Multi;
extern DWORD offset_D2Net;
//extern DWORD offset_D2sound;
extern DWORD offset_D2Win;
extern DWORD offset_Fog;
//extern DWORD offset_ijl11;
//extern DWORD offset_SmackW32;
extern DWORD offset_Storm;
/*================================= END OF FILE =================================*/

View File

@ -10,6 +10,7 @@
extern int active_DisplayItemLevel;
extern DWORD nbPlayersCommandByDefault;
extern DWORD nbPlayersCommand;
extern int active_alwaysRegenMapInSP;
extern int active_RunLODs;
extern int active_AlwaysDisplayLifeMana;

View File

@ -23,7 +23,7 @@ extern int posXPreviousBtn,posYPreviousBtn,posXNextBtn,posYNextBtn,posXSharedBtn
void toggleToSharedStash(Unit* ptChar);
void toggleToSelfStash(Unit* ptChar);
void setCurrentStashIndex(Unit* ptChar, bool isIndex);
void setCurrentStashIndex(Unit* ptChar, int index);
void selectPreviousStash(Unit* ptChar);
void selectNextStash(Unit* ptChar);
void selectPreviousIndexStash(Unit* ptChar);
@ -35,7 +35,7 @@ void selectNextIndex2Stash(Unit* ptChar);
void swapStash(Unit* ptChar, DWORD page, bool toggle);
void renameCurrentStash(Unit* ptChar, char* name);
void insertStash(Unit* ptChar);
bool deleteStash(Unit* ptChar);
bool deleteStash(Unit* ptChar, bool isClient);
void selectStash(Unit* ptChar, Stash* newStash);
void setSelectedStashClient(DWORD stashId, DWORD stashFlags, DWORD flags, bool bOnlyItems);

View File

@ -6,9 +6,7 @@
=================================================================*/
#pragma once
#define PLUGY_VERSION "11.01"
#define LOG_FILE "PlugY.log"
#define PLUGY_VERSION "11.02"
enum TargetMod
{

View File

@ -21,6 +21,7 @@ struct Stash
struct {
DWORD isShared:1; //
DWORD isIndex:1; //
DWORD isMainIndex:1; //
DWORD isReserved:1; // For swap items comand
};
};

View File

@ -1,4 +1,3 @@
/*=================================================================
File created by Yohann NICOLAS.
Add support 1.13d by L'Autour.
@ -9,50 +8,21 @@
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#include "../Commons/VersionInfo.h"
#include <windows.h>
#include <stdio.h>
const char* boxNameInstall = "Installation of PlugY, The Survival Kit Installation";
const char* boxNameUnInstall = "Uninstall PlugY, The Survival Kit ";
DWORD loadCallerAddr;
DWORD loadCallerLen;
BYTE loadCallerNew[6] = { 0x90,0xE8,0x00,0x00,0x00,0x00 }; // Call load PlugY library
BYTE loadCallerOld[6] = { 0xFF,0x15,0x00,0x00,0x00,0x00 }; // CALL DWORD PTR DS:[<&KERNEL32.LoadLibrary>]
int CALL_LOAD[8] = { 0x389B,0x389B,0x3870,0x8B23,0xB423,0x8F63,0xB423,0xAA03 };
BYTE callNewLoad[8][6] = { { 0xE8,0x60,0x85,0x00,0x00,0x90 },// JMP 6FA7BE00-6FA738A0 ;install loadlibrary
{ 0xE8,0x60,0x85,0x00,0x00,0x90 },// JMP 6FA7BE00-6FA738A0 ;install loadlibrary
{ 0xE8,0x8B,0x85,0x00,0x00,0x90 },// JMP 6FA7BE00-6FA73875 ;install loadlibrary
{ 0xE8,0xD8,0x42,0x00,0x00,0x90 },// JMP 6FA8CE00-6FA88B28 ;install loadlibrary
{ 0xE8,0xD8,0x19,0x00,0x00,0x90 },// JMP 6FA8CE00-6FA8B428 ;install loadlibrary
{ 0xE8,0x98,0x3E,0x00,0x00,0x90 },// JMP 6FA8CE00-6FA88F68 ;install loadlibrary
{ 0xE8,0xD8,0x19,0x00,0x00,0x90 },// JMP 6FA8CE00-6FA8B428 ;install loadlibrary
{ 0xE8,0xF8,0x23,0x00,0x00,0x90 }};// JMP 6FA8CE00-6FA8B428 ;install loadlibrary
BYTE callOldLoad[8][6] = { { 0xFF,0x15,0x3C,0xC0,0xA7,0x6F },
{ 0xFF,0x15,0x3C,0xC0,0xA7,0x6F },
{ 0xFF,0x15,0x40,0xC0,0xA7,0x6F },
{ 0xFF,0x15,0x1C,0xD1,0xA8,0x6F },
{ 0xFF,0x15,0x1C,0xD1,0xA8,0x6F },
{ 0xFF,0x15,0x1C,0xD1,0xA8,0x6F },
{ 0xFF,0x15,0x1C,0xD1,0xA8,0x6F },
{ 0xFF,0x15,0x1C,0xD1,0xA8,0x6F }};
DWORD freeCallerAddr;
DWORD freeCallerLen;
BYTE freeCallerNew[6] = { 0x90,0xE8,0x00,0x00,0x00,0x00 }; // Call free PlugY library
BYTE freeCallerOld[6] = { 0xFF,0x15,0x00,0x00,0x00,0x00 }; // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
int CALL_FREE[8] = { 0x3A8C,0x3A8C,0x3A6D,0x8ACA,0xB3CA,0x8F0A,0xB3CA,0xA9AA };
BYTE callNewFree[8][6] = { { 0xE8,0xAF,0x83,0x00,0x00,0x90 }, // JMP 6FA7BE40-6FA73A91 ;install freelibrary
{ 0xE8,0xAF,0x83,0x00,0x00,0x90 }, // JMP 6FA7BE40-6FA73A91 ;install freelibrary
{ 0xE8,0xD2,0x83,0x00,0x00,0x90 }, // JMP 6FA7BE44-6FA73A72 ;install freelibrary
{ 0xE8,0x75,0x43,0x00,0x00,0x90 }, // JMP 6FA8CE44-6FA88ACF ;install freelibrary
{ 0xE8,0x75,0x1A,0x00,0x00,0x90 }, // JMP 6FA8CE44-6FA8B3CF ;install freelibrary
{ 0xE8,0x35,0x3F,0x00,0x00,0x90 }, // JMP 6FA8CE44-6FA88F0F ;install freelibrary
{ 0xE8,0x75,0x1A,0x00,0x00,0x90 },// JMP 6FA8CE44-6FA8B3CF ;install freelibrary
{ 0xE8,0x95,0x24,0x00,0x00,0x90 }};// JMP 6FA8CE44-6FA8B3CF ;install freelibrary
BYTE callOldFree[8][6] = { { 0xFF,0x15,0x44,0xC0,0xA7,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x44,0xC0,0xA7,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x48,0xC0,0xA7,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x2C,0xD1,0xA8,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x2C,0xD1,0xA8,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x2C,0xD1,0xA8,0x6F }, // CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x2C,0xD1,0xA8,0x6F },// CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
{ 0xFF,0x15,0x24,0xD1,0xA8,0x6F }};// CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>]
int CALLER_LOADPLUGY = 0xBE00;//6FA7BE00-6FA70000
BYTE caller_LoadPlugY[] = {
DWORD loadDllAddr;
DWORD loadDllLen;
BYTE loadDll[] = {
0xFF,0x74,0x24,0x04, //PUSH DWORD PTR SS:[ESP+4]
0xFF,0x15,0x40,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.LoadLibraryA>] ; kernel32.LoadLibraryA
0x50, //PUSH EAX
@ -60,35 +30,45 @@ BYTE caller_LoadPlugY[] = {
0xFF,0x15,0x40,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.LoadLibraryA>] ; kernel32.LoadLibraryA
0xA3,0xFC,0xEF,0xA8,0x6F, //MOV DWORD PTR DS:[6FA8EFFC],EAX
0x85,0xC0, //TEST EAX,EAX
0x74,0x18, //JE SHORT d2gfx.6FA7BE37
0x68,0x90,0xBE,0xA7,0x6F, //PUSH d2gfx.6FA7BE10 ;Init ID
0x74,0x2B, //JE SHORT d2gfx.6FA7BE33
0x50, //PUSH EAX
0x68,0x90,0xBE,0xA7,0x6F, //PUSH d2gfx.6FA7BE10 ;Init String
0x50, //PUSH EAX
0xFF,0x15,0x3C,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.GetProcAddress>] ; kernel32.GetProcAddress
0x85,0xC0, //TEST EAX,EAX
0x74,0x04, //JE SHORT d2gfx.6FA7BDC1
0x6A,0x00, //PUSH 0
0xEB,0x13, //JMP SHORT d2gfx.6FA7BDC1
0x68,0x10,0x27,0x00,0x00, //PUSH 2710 ;Init Ordinal(10000)
0xFF,0x74,0x24,0x04, //PUSH DWORD PTR SS:[ESP+4]
0xFF,0x15,0x3C,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.GetProcAddress>] ; kernel32.GetProcAddress
0x85,0xC0, //TEST EAX,EAX
0x74,0x02, //JE SHORT d2gfx.6FA7BDC1
0xFF,0xD0, //CALL EAX
0x58, //POP EAX
0x58, //POP EAX
0xC2,0x04,0x00, //RETN 4
0x59, //POP ECX
0xB9,0x80,0xBE,0xA7,0x6F, //MOV ECX,d2gfx.6FA7BE80 ; ASCII "PlugY.dll"
0x83,0x04,0x24,0x11, //ADD DWORD PTR SS:[ESP],11
0xC2,0x04,0x00 }; //RETN 4
0x00,0x00,0x00,0x00 }; //HANDLE var;
int CALLER_FREEPLUGY = 0xBE44;//6FA7BE44-6FA70000
BYTE caller_FreePlugY[] = {
DWORD freeDllAddr;
DWORD freeDllLen;
BYTE freeDll[] = {
0xFF,0x74,0x24,0x04, //PUSH DWORD PTR SS:[ESP+4]
0xFF,0x15,0x48,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>] ; kernel32.FreeLibrary
0x50, //PUSH EAX
0xA1,0xFC,0xEF,0xA8,0x6F, //MOV EAX,DWORD PTR DS:[6FA8EFFC]
0x85,0xC0, //TEST EAX,EAX
0x74,0x20, //JE SHORT d2gfx.6FA7BE74
0x74,0x2D, //JE SHORT d2gfx.6FA7BE74
0x50, //PUSH EAX
0x68,0xA0,0xBE,0xA7,0x6F, //PUSH d2gfx.6FA7BE20 ;release
0x68,0xA0,0xBE,0xA7,0x6F, //PUSH d2gfx.6FA7BE20 ;Release String
0x50, //PUSH EAX
0x33,0xC0, //XOR EAX,EAX
0xA3,0xFC,0xEF,0xA8,0x6F, //MOV DWORD PTR DS:[6FA8EFFC],EAX
//0x33,0xC0, //XOR EAX,EAX
//0xA3,0xFC,0xEF,0xA8,0x6F, //MOV DWORD PTR DS:[6FA8EFFC],EAX
0xFF,0x15,0x3C,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.GetProcAdd>; kernel32.GetProcAddress
0x85,0xC0, //TEST EAX,EAX
0x75,0x13, //JNZ SHORT d2gfx.6FA7BDEF
0x68,0x11,0x27,0x00,0x00, //PUSH 2711 ;Release Ordinal(10001)
0xFF,0x74,0x24,0x04, //PUSH DWORD PTR SS:[ESP+4]
0xFF,0x15,0x3C,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.GetProcAdd>; kernel32.GetProcAddress
0x85,0xC0, //TEST EAX,EAX
0x74,0x02, //JE SHORT d2gfx.6FA7BDEF
@ -97,328 +77,392 @@ BYTE caller_FreePlugY[] = {
0x58, //POP EAX
0xC2,0x04,0x00 }; //RETN 4
DWORD libraryNameAddr;
DWORD libraryNameLen;
LPCSTR libraryName = "PlugY.dll";
int S_DLLNAME = 0xBE80;//6FA7BE30-6FA70000
BYTE sDllName[] = { 'P','l','u','g','Y','.','d','l','l',0 };// Dll filename to load.
DWORD initNameAddr;
DWORD initNameLen;
LPCSTR initName = "_Init@4";
int S_INIT = 0xBE90;//6FA7BE10-6FA70000
BYTE sInit[] = { '_','I','n','i','t','@','4',0 };
DWORD releaseNameAddr;
DWORD releaseNameLen;
LPCSTR releaseName = "_Release@0";
int S_RELEASE = 0xBEA0;//6FA7BE20-6FA70000
BYTE sRelease[] = { '_','R','e','l','e','a','s','e','@','0',0 };
void updateData(int version)
int msgBox(LPCSTR boxName, UINT uType, LPCSTR pFormat, ...)
{
switch (version)
{
case V109b:
case V109d:
caller_LoadPlugY[6] -= 4;
caller_LoadPlugY[18] -= 4;
caller_LoadPlugY[39] -= 4;
caller_FreePlugY[6] -= 4;
caller_FreePlugY[36] -= 4;
caller_FreePlugY[48] -= 4;
break;
case V110:
break;
case V111:
case V111b:
case V112:
case V113c:
case V113d:
CALLER_LOADPLUGY += 0x1000;
CALLER_FREEPLUGY += 0x1000;
S_INIT += 0x1000;
S_RELEASE += 0x1000;
S_DLLNAME += 0x1000;
*(DWORD*)(&caller_LoadPlugY[6]) = 0x6FA8D11C;
*(DWORD*)(&caller_LoadPlugY[18]) = 0x6FA8D11C;
*(DWORD*)(&caller_LoadPlugY[39]) = 0x6FA8D120;
*(DWORD*)(&caller_FreePlugY[6]) = (version == V113d) ? 0x6FA8D124 : 0x6FA8D12C;
*(DWORD*)(&caller_FreePlugY[36]) = 0x6FA8D120;
*(DWORD*)(&caller_FreePlugY[48]) = (version == V113d) ? 0x6FA8D124 : 0x6FA8D12C;
caller_LoadPlugY[13] += 0x10;
caller_LoadPlugY[14]++;
caller_LoadPlugY[25]++;
caller_LoadPlugY[33] += 0x10;
caller_LoadPlugY[34]++;
caller_LoadPlugY[58] += 0x10;
caller_LoadPlugY[59]++;
caller_FreePlugY[23] += 0x10;
caller_FreePlugY[24]++;
caller_FreePlugY[14]++;
caller_FreePlugY[32]++;
break;
}
char buffer[300];
va_list lArgs;
va_start( lArgs, pFormat );
vsprintf_s( buffer, sizeof(buffer), pFormat, lArgs );
va_end(lArgs);
return MessageBox(NULL, buffer, boxName, uType);
}
int Align(int v)
{
return v % 16 ? v + 16 - v % 16 : v;
}
////////////////////////////// EXPORTED FUNCTIONS //////////////////////////////
void Patch()
int Patch(FILE *targetFile)
{
if (MessageBox(0, "This programm will modify the D2gfx.dll file of the current directory.\n"
"Before continue, don't forgot to backup D2gfx.dll if you want\n"
"Do you want patch D2gfx.dll for the launch of PlugY ?",
boxNameInstall, MB_YESNO | MB_ICONQUESTION) == IDNO)
{
MessageBox(0, "D2gfx.dll isn't patched.\n",
boxNameInstall, MB_OK | MB_ICONASTERISK);
exit(0);
}
FILE *dll;
if (fopen_s(&dll, "d2gfx.dll", "rb+"))
{
MessageBox(0, "Can't open D2gfx.dll in read/write mode.\n"
"If Diablo II is running you can\'t install PlugY, The Survival Kit.\n"
"Quit Diablo II and try again.",
boxNameInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
int version = GetD2Version("Game.exe");
if (version < V109 || version > V113d)
{
MessageBox(0, "Bad version of D2gfx.dll.\n"
"You can try to uninstall any previous version of PlugY, The Survival Kit then retry.\n"
"Or re-install a clean version (between 1.09 and 1.13d) of LOD.",
boxNameInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
updateData(version);
bool error = false;
int ident = 0;
BYTE buffer[100];
BYTE zeros[100];
memset(zeros, 0, sizeof(zeros));
version -= V109b;
fseek(targetFile, loadCallerAddr, SEEK_SET);
fread(buffer, sizeof(loadCallerNew), 1, targetFile);
if (memcmp(buffer, loadCallerOld, sizeof(loadCallerNew)) != 0) error = true;
if (memcmp(buffer, loadCallerNew, sizeof(loadCallerNew)) == 0) ident++;
fseek(dll, CALL_LOAD[version], SEEK_SET);
fread(buffer, 6, 1, dll);
if (memcmp(buffer, callOldLoad[version], 6) != 0) error = true;
if (memcmp(buffer, callNewLoad[version], 6) == 0) ident++;
fseek(targetFile, freeCallerAddr, SEEK_SET);
fread(buffer, sizeof(freeCallerNew), 1, targetFile);
if (memcmp(buffer, freeCallerOld, sizeof(freeCallerNew)) != 0) error = true;
if (memcmp(buffer, freeCallerNew, sizeof(freeCallerNew)) == 0) ident++;
fseek(dll, CALL_FREE[version], SEEK_SET);
fread(buffer, 6, 1, dll);
if (memcmp(buffer, callOldFree[version], 6) != 0) error = true;
if (memcmp(buffer, callNewFree[version], 6) == 0) ident++;
fseek(targetFile, loadDllAddr, SEEK_SET);
fread(buffer, sizeof(loadDll), 1, targetFile);
if (memcmp(buffer, zeros, sizeof(loadDll)) != 0) error = true;
if (memcmp(buffer, loadDll, sizeof(loadDll)) == 0) ident++;
fseek(dll, CALLER_LOADPLUGY, SEEK_SET);
fread(buffer, sizeof(caller_LoadPlugY), 1, dll);
if (memcmp(buffer, zeros, sizeof(caller_LoadPlugY)) != 0) error = true;
if (memcmp(buffer, caller_LoadPlugY, sizeof(caller_LoadPlugY)) == 0) ident++;
fseek(targetFile, freeDllAddr, SEEK_SET);
fread(buffer, sizeof(freeDll), 1, targetFile);
if (memcmp(buffer, zeros, sizeof(freeDll)) != 0) error = true;
if (memcmp(buffer, freeDll, sizeof(freeDll)) == 0) ident++;
fseek(dll, CALLER_FREEPLUGY, SEEK_SET);
fread(buffer, sizeof(caller_FreePlugY), 1, dll);
if (memcmp(buffer, zeros, sizeof(caller_FreePlugY)) != 0) error = true;
if (memcmp(buffer, caller_FreePlugY, sizeof(caller_FreePlugY)) == 0) ident++;
fseek(targetFile, initNameAddr, SEEK_SET);
fread(buffer, initNameLen, 1, targetFile);
if (memcmp(buffer, zeros, initNameLen) != 0) error = true;
if (memcmp(buffer, initName, initNameLen) == 0) ident++;
fseek(dll, S_INIT, SEEK_SET);
fread(buffer, sizeof(sInit), 1, dll);
if (memcmp(buffer, zeros, sizeof(sInit)) != 0) error = true;
if (memcmp(buffer, sInit, sizeof(sInit)) == 0) ident++;
fseek(targetFile, releaseNameAddr, SEEK_SET);
fread(buffer, releaseNameLen, 1, targetFile);
if (memcmp(buffer, zeros, releaseNameLen) != 0) error = true;
if (memcmp(buffer, releaseName, releaseNameLen) == 0) ident++;
fseek(dll, S_RELEASE, SEEK_SET);
fread(buffer, sizeof(sRelease), 1, dll);
if (memcmp(buffer, zeros, sizeof(sRelease)) != 0) error = true;
if (memcmp(buffer, sRelease, sizeof(sRelease)) == 0) ident++;
fseek(dll, S_DLLNAME, SEEK_SET);
fread(buffer, sizeof(sDllName), 1, dll);
if (memcmp(buffer, zeros, sizeof(sDllName)) != 0) error = true;
if (memcmp(buffer, sDllName, sizeof(sDllName)) == 0) ident++;
fseek(targetFile, libraryNameAddr, SEEK_SET);
fread(buffer, libraryNameLen, 1, targetFile);
if (memcmp(buffer, zeros, libraryNameLen) != 0) error = true;
if (memcmp(buffer, libraryName, libraryNameLen) == 0) ident++;
if (error)
{
if (ident == 7)
{
MessageBox(0, "PlugY, The Survival Kit already installed.",
boxNameInstall, MB_OK | MB_ICONASTERISK);
exit(0);
}
else
{
MessageBox(0, "Bad version of D2gfx.dll.\n"
"You can try to uninstall any previous version of PlugY, The Survival Kit then retry.\n"
"Or re-install a clean version (between 1.09 and 1.13d) of LOD.",
boxNameInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
}
return ident == 7 ? 1 : 2;
fseek(dll, CALL_LOAD[version], SEEK_SET);
fwrite(callNewLoad[version], 6, 1, dll);
fseek(targetFile, loadCallerAddr, SEEK_SET);
fwrite(loadCallerNew, 6, 1, targetFile);
fseek(dll, CALL_FREE[version], SEEK_SET);
fwrite(callNewFree[version], 6, 1, dll);
fseek(targetFile, freeCallerAddr, SEEK_SET);
fwrite(freeCallerNew, 6, 1, targetFile);
fseek(dll, CALLER_LOADPLUGY, SEEK_SET);
fwrite(caller_LoadPlugY, sizeof(caller_LoadPlugY), 1, dll);
fseek(targetFile, loadDllAddr, SEEK_SET);
fwrite(loadDll, sizeof(loadDll), 1, targetFile);
fseek(dll, CALLER_FREEPLUGY, SEEK_SET);
fwrite(caller_FreePlugY, sizeof(caller_FreePlugY), 1, dll);
fseek(targetFile, freeDllAddr, SEEK_SET);
fwrite(freeDll, sizeof(freeDll), 1, targetFile);
fseek(dll, S_INIT, SEEK_SET);
fwrite(sInit, sizeof(sInit), 1, dll);
fseek(targetFile, initNameAddr, SEEK_SET);
fwrite(initName, initNameLen, 1, targetFile);
fseek(dll, S_RELEASE, SEEK_SET);
fwrite(sRelease, sizeof(sRelease), 1, dll);
fseek(targetFile, releaseNameAddr, SEEK_SET);
fwrite(releaseName, releaseNameLen, 1, targetFile);
fseek(dll, S_DLLNAME, SEEK_SET);
fwrite(sDllName, sizeof(sDllName), 1, dll);
fseek(targetFile, libraryNameAddr, SEEK_SET);
fwrite(libraryName, libraryNameLen, 1, targetFile);
fclose(dll);
MessageBox(0, "D2gfx.dll patched successfully.\n"
"PlugY, The Survival Kit installed successfully.",
boxNameInstall, MB_OK | MB_ICONASTERISK);
exit(0);
return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
void Unpatch()
int Unpatch(FILE *targetFile)
{
if (MessageBox(0, "This programm will modify the D2gfx.dll file of the current directory.\n"
"Before continue, don't forgot to backup D2gfx.dll if you want\n"
"Do you want patch D2gfx.dll for remove the launch of PlugY ?",
boxNameUnInstall, MB_YESNO | MB_ICONQUESTION) == IDNO)
{
MessageBox(0, "D2gfx.dll isn't patched.\n",
boxNameUnInstall, MB_OK | MB_ICONASTERISK);
exit(0);
}
FILE *dll;
if (fopen_s(&dll, "d2gfx.dll", "rb+"))
{
MessageBox(0, "Can't open D2gfx.dll in read/write mode.\n"
"If Diablo II is running you can\'t install PlugY, The Survival Kit.\n"
"Quit Diablo II and try again.",
boxNameUnInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
int version = GetD2Version("Game.exe");
if (version < V109 || version > V113d)
{
MessageBox(0, "Bad version of D2gfx.dll.\n"
"You can try to uninstall any previous version of PlugY, The Survival Kit then retry.\n"
"Or re-install a clean version (between 1.09 and 1.13d) of LOD.",
boxNameUnInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
updateData(version);
bool error = false;
int ident = 0;
BYTE buffer[100];
BYTE zeros[100];
memset(zeros, 0, sizeof(zeros));
version -= V109b;
fseek(targetFile, loadCallerAddr, SEEK_SET);
fread(buffer, 6, 1, targetFile);
if (memcmp(buffer, loadCallerNew, 6) != 0) error = true;
if (memcmp(buffer, loadCallerOld, 6) == 0) ident++;
fseek(dll, CALL_LOAD[version], SEEK_SET);
fread(buffer, 6, 1, dll);
if (memcmp(buffer, callNewLoad[version], 6) != 0) error = true;
if (memcmp(buffer, callOldLoad[version], 6) == 0) ident++;
fseek(targetFile, freeCallerAddr, SEEK_SET);
fread(buffer, 6, 1, targetFile);
if (memcmp(buffer, freeCallerNew, 6) != 0) error = true;
if (memcmp(buffer, freeCallerOld, 6) == 0) ident++;
fseek(dll, CALL_FREE[version], SEEK_SET);
fread(buffer, 6, 1, dll);
if (memcmp(buffer, callNewFree[version], 6) != 0) error = true;
if (memcmp(buffer, callOldFree[version], 6) == 0) ident++;
fseek(targetFile, loadDllAddr, SEEK_SET);
fread(buffer, sizeof(loadDll), 1, targetFile);
if (memcmp(buffer, loadDll, sizeof(loadDll)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(loadDll)) == 0) ident++;
fseek(dll, CALLER_LOADPLUGY, SEEK_SET);
fread(buffer, sizeof(caller_LoadPlugY), 1, dll);
if (memcmp(buffer, caller_LoadPlugY, sizeof(caller_LoadPlugY)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(caller_LoadPlugY)) == 0) ident++;
fseek(targetFile, freeDllAddr, SEEK_SET);
fread(buffer, sizeof(freeDll), 1, targetFile);
if (memcmp(buffer, freeDll, sizeof(freeDll)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(freeDll)) == 0) ident++;
fseek(dll, CALLER_FREEPLUGY, SEEK_SET);
fread(buffer, sizeof(caller_FreePlugY), 1, dll);
if (memcmp(buffer, caller_FreePlugY, sizeof(caller_FreePlugY)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(caller_FreePlugY)) == 0) ident++;
fseek(targetFile, initNameAddr, SEEK_SET);
fread(buffer, initNameLen, 1, targetFile);
if (memcmp(buffer, initName, initNameLen) != 0) error = true;
if (memcmp(buffer, zeros, initNameLen) == 0) ident++;
fseek(dll, S_INIT, SEEK_SET);
fread(buffer, sizeof(sInit), 1, dll);
if (memcmp(buffer, sInit, sizeof(sInit)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(sInit)) == 0) ident++;
fseek(targetFile, releaseNameAddr, SEEK_SET);
fread(buffer, releaseNameLen, 1, targetFile);
if (memcmp(buffer, releaseName, releaseNameLen) != 0) error = true;
if (memcmp(buffer, zeros, releaseNameLen) == 0) ident++;
fseek(dll, S_RELEASE, SEEK_SET);
fread(buffer, sizeof(sRelease), 1, dll);
if (memcmp(buffer, sRelease, sizeof(sRelease)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(sRelease)) == 0) ident++;
fseek(dll, S_DLLNAME, SEEK_SET);
fread(buffer, sizeof(sDllName), 1, dll);
if (memcmp(buffer, sDllName, sizeof(sDllName)) != 0) error = true;
if (memcmp(buffer, zeros, sizeof(sDllName)) == 0) ident++;
fseek(targetFile, libraryNameAddr, SEEK_SET);
fread(buffer, libraryNameLen, 1, targetFile);
if (memcmp(buffer, libraryName, libraryNameLen) != 0) error = true;
if (memcmp(buffer, zeros, libraryNameLen) == 0) ident++;
if (error)
{
if (ident == 7)
{
MessageBox(0, "PlugY, The Survival Kit already uninstalled.",
boxNameUnInstall, MB_OK | MB_ICONASTERISK);
exit(0);
}
else
{
MessageBox(0, "Bad version of D2gfx.dll.\n"
"Unable to uninstall PlugY, The Survival Kit.",
boxNameUnInstall, MB_OK | MB_ICONEXCLAMATION);
exit(0);
}
}
return ident == 7 ? 1 : 2;
fseek(dll, CALL_LOAD[version], SEEK_SET);
fwrite(callOldLoad[version], 6, 1, dll);
fseek(targetFile, loadCallerAddr, SEEK_SET);
fwrite(loadCallerOld, 6, 1, targetFile);
fseek(dll, CALL_FREE[version], SEEK_SET);
fwrite(callOldFree[version], 6, 1, dll);
fseek(targetFile, freeCallerAddr, SEEK_SET);
fwrite(freeCallerOld, 6, 1, targetFile);
fseek(dll, CALLER_LOADPLUGY, SEEK_SET);
fwrite(zeros, sizeof(caller_LoadPlugY), 1, dll);
fseek(targetFile, loadDllAddr, SEEK_SET);
fwrite(zeros, sizeof(loadDll), 1, targetFile);
fseek(dll, CALLER_FREEPLUGY, SEEK_SET);
fwrite(zeros, sizeof(caller_FreePlugY), 1, dll);
fseek(targetFile, freeDllAddr, SEEK_SET);
fwrite(zeros, sizeof(freeDll), 1, targetFile);
fseek(dll, S_INIT, SEEK_SET);
fwrite(zeros, sizeof(sInit), 1, dll);
fseek(targetFile, initNameAddr, SEEK_SET);
fwrite(zeros, initNameLen, 1, targetFile);
fseek(dll, S_RELEASE, SEEK_SET);
fwrite(zeros, sizeof(sRelease), 1, dll);
fseek(targetFile, releaseNameAddr, SEEK_SET);
fwrite(zeros, releaseNameLen, 1, targetFile);
fseek(dll, S_DLLNAME, SEEK_SET);
fwrite(zeros, sizeof(sDllName), 1, dll);
fseek(targetFile, libraryNameAddr, SEEK_SET);
fwrite(zeros, libraryNameLen, 1, targetFile);
fclose(dll);
MessageBox(0, "D2gfx.dll patched successfully.\n"
"PlugY, The Survival Kit uninstalled successfully.",
boxNameUnInstall, MB_OK | MB_ICONASTERISK);
exit(0);
return 0;
}
int main(int argc, char * argv[])
{
// if ((argc>1) && !strcmp(argv[1],"-u"))
#ifdef RESTORE
Unpatch();
bool unpatch = true;
#else
if ((argc>1) && !strcmp(argv[1], "-u"))
Unpatch();
else
Patch();
bool unpatch = argc > 1 && strcmp(argv[1], "-u") == 0;
#endif
int version = GetD2Version("Game.exe");
LPCSTR boxName = unpatch ? "Uninstall PlugY, The Survival Kit" : "Install PlugY, The Survival Kit";
LPCSTR targetFilename = version > V113d ? "Game.exe" : "D2gfx.dll";
if (version < V107 || version > V114d)
{
msgBox(boxName, MB_OK | MB_ICONEXCLAMATION,
"Current version of LoD (%s) isn't compatible with PlugY.\n\n"
"Please, install a patch between 1.09 and 1.13d.",
GetVersionString(version));
exit(0);
}
if (msgBox(boxName, MB_YESNO | MB_ICONQUESTION,
"This programm will modify %s file in current directory.\n"
"Before continue, you should backup it.\n\n"
"Do you want to modify %s to %s PlugY ?",
targetFilename, targetFilename, unpatch ? "remove": "install") == IDNO)
{
msgBox(boxName, MB_OK | MB_ICONASTERISK, "No changes made.");
exit(0);
}
FILE *targetFile;
if (fopen_s(&targetFile, targetFilename, "rb+"))
{
msgBox(boxName, MB_OK | MB_ICONEXCLAMATION,
"Can't open %s in read/write mode.\n"
"If Diablo II is running, can you close it and try again ?",
targetFilename, unpatch ? "remove": "install");
exit(0);
}
// Get size
loadCallerLen = sizeof(loadCallerNew);
freeCallerLen = sizeof(freeCallerNew);
loadDllLen = sizeof(loadDll);
freeDllLen = sizeof(freeDll);
libraryNameLen = strlen(libraryName) + 1;
initNameLen = strlen(initName) + 1;
releaseNameLen = strlen(releaseName) + 1;
// Get Addr
DWORD offsetPESignature;
fseek(targetFile, 0x3C, SEEK_SET);
fread(&offsetPESignature, sizeof(offsetPESignature), 1, targetFile);
DWORD sizeOfCode;
fseek(targetFile, offsetPESignature + 0x1C, SEEK_SET);
fread(&sizeOfCode, sizeof(sizeOfCode), 1, targetFile);
DWORD baseOfCode;
fseek(targetFile, offsetPESignature + 0x2C, SEEK_SET);
fread(&baseOfCode, sizeof(baseOfCode), 1, targetFile);
DWORD imageBase;
fseek(targetFile, offsetPESignature + 0x34, SEEK_SET);
fread(&imageBase, sizeof(imageBase), 1, targetFile);
DWORD sizeOfData;
fseek(targetFile, offsetPESignature + 0x150, SEEK_SET);
fread(&sizeOfData, sizeof(sizeOfData), 1, targetFile);
DWORD baseOfData;
fseek(targetFile, offsetPESignature + 0x154, SEEK_SET);
fread(&baseOfData, sizeof(baseOfData), 1, targetFile);
// Set Addr
DWORD loadLibraryAddr = imageBase;
DWORD freeLibraryAddr = imageBase;
DWORD getProcAddressAddr = imageBase;
DWORD handleAddr = imageBase + baseOfData + sizeOfData;
loadCallerAddr = 0;
freeCallerAddr = 0;
loadDllAddr = Align(baseOfCode + sizeOfCode - 0x100);
freeDllAddr = Align(loadDllAddr + sizeof(loadDll));
libraryNameAddr = Align(freeDllAddr + sizeof(freeDll));
initNameAddr = Align(libraryNameAddr + libraryNameLen);
releaseNameAddr = Align(initNameAddr + initNameLen);
switch (version)
{
case V107:
loadCallerAddr += 0x3882;
freeCallerAddr += 0x3A6C;
loadLibraryAddr += 0xC038;
freeLibraryAddr += 0xC040;
getProcAddressAddr += 0xC034;
break;
case V108:
case V109:
case V109b:
case V109d:
loadCallerAddr += 0x389B;
freeCallerAddr += 0x3A8C;
loadLibraryAddr += 0xC03C;
freeLibraryAddr += 0xC044;
getProcAddressAddr += 0xC038;
break;
case V110:
loadCallerAddr += 0x3870;
freeCallerAddr += 0x3A6D;
loadLibraryAddr += 0xC040;
freeLibraryAddr += 0xC048;
getProcAddressAddr += 0xC03C;
break;
case V111:
loadCallerAddr += 0x8B23;
freeCallerAddr += 0x8ACA;
loadLibraryAddr += 0xD11C;
freeLibraryAddr += 0xD12C;
getProcAddressAddr += 0xD120;
break;
case V111b:
loadCallerAddr += 0xB423;
freeCallerAddr += 0xB3CA;
loadLibraryAddr += 0xD11C;
freeLibraryAddr += 0xD12C;
getProcAddressAddr += 0xD120;
break;
case V112:
loadCallerAddr += 0x8F63;
freeCallerAddr += 0x8F0A;
loadLibraryAddr += 0xD11C;
freeLibraryAddr += 0xD12C;
getProcAddressAddr += 0xD120;
break;
case V113c:
loadCallerAddr += 0xB423;
freeCallerAddr += 0xB3CA;
loadLibraryAddr += 0xD11C;
freeLibraryAddr += 0xD12C;
getProcAddressAddr += 0xD120;
break;
case V113d:
loadCallerAddr += 0xAA03;
freeCallerAddr += 0xA9AA;
loadLibraryAddr += 0xD11C;
freeLibraryAddr += 0xD124;
getProcAddressAddr += 0xD120;
break;
case V114a:
loadCallerAddr += 0x1BCB;// Load advapi.dll
freeCallerAddr += 0xF375;// Free dbghelp.dll
loadLibraryAddr += 0x2CD118;
freeLibraryAddr += 0x2CD120;
getProcAddressAddr += 0x2CD11C;
break;
case V114b:
case V114c:
loadCallerAddr += 0x1BCB;// Load advapi.dll
freeCallerAddr += 0x6F75;// Free dbghelp.dll
loadLibraryAddr += 0x2CD11C;
freeLibraryAddr += 0x2CD124;
getProcAddressAddr += 0x2CD120;
break;
case V114d:
loadCallerAddr += 0x621C;// Load advapi.dll
freeCallerAddr += 0xB514;// Free dbghelp.dll
loadLibraryAddr += 0x2CC144;
freeLibraryAddr += 0x2CC14C;
getProcAddressAddr += 0x2CC148;
break;
default:
return false;
}
*(DWORD*)&loadCallerNew[2] = loadDllAddr - (loadCallerAddr + sizeof(loadCallerNew));
*(DWORD*)&loadCallerOld[2] = loadLibraryAddr;
*(DWORD*)&freeCallerNew[2] = freeDllAddr - (freeCallerAddr + sizeof(freeCallerNew));
*(DWORD*)&freeCallerOld[2] = freeLibraryAddr;
*(DWORD*)&loadDll[6] = loadLibraryAddr;
*(DWORD*)&loadDll[12] = imageBase + libraryNameAddr;
*(DWORD*)&loadDll[18] = loadLibraryAddr;
*(DWORD*)&loadDll[23] = handleAddr;
*(DWORD*)&loadDll[33] = imageBase + initNameAddr;
*(DWORD*)&loadDll[40] = getProcAddressAddr;
*(DWORD*)&loadDll[63] = getProcAddressAddr;
*(DWORD*)&freeDll[6] = freeLibraryAddr;
*(DWORD*)&freeDll[12] = handleAddr;
*(DWORD*)&freeDll[22] = imageBase + releaseNameAddr;
*(DWORD*)&freeDll[29] = getProcAddressAddr;
*(DWORD*)&freeDll[48] = getProcAddressAddr;
*(DWORD*)&freeDll[60] = freeLibraryAddr;
// Patch / Unpatch
int res;
if (unpatch)
res = Unpatch(targetFile);
else
res = Patch(targetFile);
fclose(targetFile);
if (res == 0)
msgBox(boxName, MB_OK | MB_ICONASTERISK,
"%s was modified.\n"
"PlugY, The Survival Kit %s.",
targetFilename, unpatch ? "is removed" : "is installed");
else if (res == 1)
msgBox(boxName, MB_OK | MB_ICONASTERISK,
"PlugY, The Survival Kit already %s.",
unpatch ? "uninstalled" : "installed");
else if (res == 2)
msgBox(boxName, MB_OK | MB_ICONASTERISK,
"File contents in %s isn't correct.\n"
"Unable to %s PlugY, The Survival Kit.",
targetFilename, unpatch ? "uninstall" : "install");
return 1;
}
///////////////////////// END OF FILE ///////////////////////

View File

@ -50,7 +50,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright (C) 2017"
VALUE "OriginalFilename", "PlugYInstall.exe"
VALUE "ProductName", "PlugY, The Survival Kit"
VALUE "ProductVersion", "11.01"
VALUE "ProductVersion", "11.02"
END
END
BLOCK "VarFileInfo"

Binary file not shown.

View File

@ -159,7 +159,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PatchD2gfxDll.exe&quot;"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PatchD2gfxDll.exe&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@ -235,7 +235,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\RestoreD2gfxDll.exe&quot;"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\RestoreD2gfxDll.exe&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>

View File

@ -5,7 +5,7 @@
; ;
; by Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;
@ -30,7 +30,7 @@ ActiveCheckMemory=1
[WINDOWED]
ActiveWindowed=0
RemoveBorder=1
RemoveBorder=0
WindowOnTop=0
Maximized=0
SetWindowPos=0
@ -72,7 +72,7 @@ MaxPersonnalPages=0
ActiveSharedStash=1
SeparateHardcoreStash=1
OpenSharedStashOnLoading=0
displaySharedSetItemNameInGreen=1
DisplaySharedSetItemNameInGreen=1
MaxSharedPages=0
ActiveSharedGold=1
@ -117,7 +117,7 @@ SelectMainPageOnOpenning=1
[EXTRA]
ActiveLaunchAnyNumberOfLOD=1
AlwaysRegenMapInSP=0
NBPlayersByDefault=0
NBPlayersByDefault=1
ActiveDisplayItemLevel=1
AlwaysDisplayLifeAndManaValues=0
EnabledTXTFilesWhenMSExcelOpenIt=0

View File

@ -2,7 +2,7 @@
; Modified by L'Autour.
!include "MUI2.nsh"
!define VERSION "11.01"
!define VERSION "11.02"
!define D2FILES "."
!define NAME "PlugY, The Survival Kit"
!define MOD_DIR "Mod PlugY"
@ -61,9 +61,9 @@ LangString DESC_MENU_SHORTCUTS ${LANG_RUSSIAN} "
LangString DESC_UNINSTALLER ${LANG_ENGLISH} "Create a Windows uninstall program.$\nAdding registry keys in Windows."
LangString DESC_UNINSTALLER ${LANG_FRENCH} "Crée un programme Windows de désinstallation.$\nAjoute des clés de registres dans Windows."
LangString DESC_UNINSTALLER ${LANG_RUSSIAN} "Ñîçäàòü â Windows äåèíñòëëÿòîð ïðîãðàììû.$\nÄîáàâëÿåò êëþ÷è ðååñòðà â Windows."
LangString DESC_PATCH_D2GFX ${LANG_ENGLISH} "D2gfx.dll patcher to run PlugY without PlugY.exe. Before use it, you MUST read the readme."
LangString DESC_PATCH_D2GFX ${LANG_FRENCH} "D2gfx.dll patcheur pour lancer PlugY sans PlugY.exe. Avant de l'utiliser, vous DEVEZ lire le LISEZ-MOI."
LangString DESC_PATCH_D2GFX ${LANG_RUSSIAN} "Ïðèìåíèòü ïàò÷ ê D2gfx.dll äëÿ çàïóñêà PlugY áåç PlugY.exe. Ïîäðîáíåå ñìîòðåòü â ôàéëå Readme."
LangString DESC_PATCH_FILE ${LANG_ENGLISH} "Patcher to run PlugY without PlugY.exe. Before use it, you MUST read the readme."
LangString DESC_PATCH_FILE ${LANG_FRENCH} "Patcheur pour lancer PlugY sans PlugY.exe. Avant de l'utiliser, vous DEVEZ lire le LISEZ-MOI."
LangString DESC_PATCH_FILE ${LANG_RUSSIAN} "Ïðèìåíèòü ïàò÷ äëÿ çàïóñêà PlugY áåç PlugY.exe. Ïîäðîáíåå ñìîòðåòü â ôàéëå Readme."
LangString SECTION_NAME_CORE ${LANG_ENGLISH} "${NAME} (required)"
LangString SECTION_NAME_CORE ${LANG_FRENCH} "${NAME} (nécessaire)"
LangString SECTION_NAME_CORE ${LANG_RUSSIAN} "${NAME} (òðåáóåòñÿ)"
@ -76,9 +76,9 @@ LangString SECTION_NAME_STARTMENU_SHORTCUTS ${LANG_RUSSIAN} "
LangString SECTION_NAME_UNINSTALLER ${LANG_ENGLISH} "Uninstaller (add keys registers)"
LangString SECTION_NAME_UNINSTALLER ${LANG_FRENCH} "Dé-installeur (ajoute clés de registre)"
LangString SECTION_NAME_UNINSTALLER ${LANG_RUSSIAN} "Äåèíñòàëëÿòîð (äîáàâëÿåò êëþ÷è ðååñòðà)"
LangString SECTION_PATCH_D2GFX ${LANG_ENGLISH} "D2gfx.dll Patcher (advanced user only)"
LangString SECTION_PATCH_D2GFX ${LANG_FRENCH} "Patcheur de D2gfx.dll (utilisateur avancé uniquement)"
LangString SECTION_PATCH_D2GFX ${LANG_RUSSIAN} "Ïàò÷ äëÿ D2gfx.dll Patcher (äëÿ îïûòíûõ ïîëüçîâàòåëåé)"
LangString SECTION_PATCH_FILE ${LANG_ENGLISH} "File Patcher (advanced user only)"
LangString SECTION_PATCH_FILE ${LANG_FRENCH} "Patcheur de fichier (utilisateur avancé uniquement)"
LangString SECTION_PATCH_FILE ${LANG_RUSSIAN} "Ïàò÷ äëÿ Patcher (äëÿ îïûòíûõ ïîëüçîâàòåëåé)"
LangString README_FILENAME ${LANG_ENGLISH} "PlugY_The_Survival_Kit_-_Readme.txt"
LangString README_FILENAME ${LANG_FRENCH} "PlugY_The_Survival_Kit_-_LisezMoi.txt"
@ -222,10 +222,10 @@ Section $(SECTION_NAME_UNINSTALLER) Uninstaller
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "NoRepair" 1
SectionEnd
Section $(SECTION_PATCH_D2GFX) PatchD2gfx
Section $(SECTION_PATCH_FILE) PatchFile
SetOutPath $D2Path
File "${D2FILES}\PatchD2gfxDll.exe"
File "${D2FILES}\RestoreD2gfxDll.exe"
File "${D2FILES}\PatchD2File.exe"
File "${D2FILES}\RestoreD2File.exe"
SectionEnd
;--------------------------------
@ -242,8 +242,8 @@ Section "Uninstall" Uninstall
; Remove files and uninstaller
Delete "$D2Path\PlugY.dll"
Delete "$D2Path\PatchD2gfxDll.exe"
Delete "$D2Path\RestoreD2gfxDll.exe"
Delete "$D2Path\PatchD2File.exe"
Delete "$D2Path\RestoreD2File.exe"
Delete "$INSTDIR\PlugY.exe"
Delete "$INSTDIR\PlugY.log"
Delete "$INSTDIR\BnetLog.txt"
@ -273,7 +273,7 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT "${Core}" $(DESC_CORE)
!insertmacro MUI_DESCRIPTION_TEXT "${DesktopShortcuts}" $(DESC_DESKTOP_SHORTCUTS)
!insertmacro MUI_DESCRIPTION_TEXT "${MenuShortcuts}" $(DESC_MENU_SHORTCUTS)
!insertmacro MUI_DESCRIPTION_TEXT "${PatchD2gfx}" $(DESC_PATCH_D2GFX)
!insertmacro MUI_DESCRIPTION_TEXT "${PatchFile}" $(DESC_PATCH_FILE)
!insertmacro MUI_DESCRIPTION_TEXT "${Uninstaller}" $(DESC_UNINSTALLER)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

View File

@ -6,7 +6,7 @@
; ;
; by Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;
@ -75,7 +75,7 @@ ActiveSharedStash=0
SeparateHardcoreStash=1
OpenSharedStashOnLoading=0
SharedStashFilename=SharedStashSave
displaySharedSetItemNameInGreen=1
DisplaySharedSetItemNameInGreen=1
MaxSharedPages=0
ActiveSharedGold=1

View File

@ -6,7 +6,7 @@
; ;
; by Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;

View File

@ -4,7 +4,7 @@
; ;
; von Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;
@ -66,6 +66,10 @@ Jedes Feature kann via PlugY.ini an/ausgeschaltet werden (siehe "Kommentare aus
/listcube : (Beta) Erstellt eine "cube.txt" Datei im Savegame-Verzeichnis mit allen Würfelrezepten.
v11.02 Änderungen :
Add command /setmainindex : Set the current stash page as main index (shift + prev/next index button go to an main index if exists)
Current number of simulated players use with /players command is save with the player and set on game loading. NBPlayersByDefault must be different to 0 in PlugY.ini.
v11.01 Änderungen :
- Kompatibilität mit 1.13d (Vielen Dank an L'Autour)
- Befehl /unlockmouse hinzugefügt : Entfernt die Begrenzung des Mauszeigers auf das Fenster
@ -548,6 +552,7 @@ Neue Kommandos in PlugY hinzugef
/renamechar newname : Rename your character and save it. (You must exit the game to update the stats page.)
/renamepage name : Rename current page stash (MultiStash activated).
/setindex : Set current stash page as index (prev/next index button go to an index if exists) (MultiStash activated).
/setmainindex : Set current stash page as main index (shift + prev/next index button go to an main index if exists) (MultiStash activated).
/resetindex : Remove index flag on the current stash page (MultiStash activated).
/insertpage : Insert a new page after the current page (MultiStash activated).
/deletepage : Delete current page if empty (MultiStash activated).

View File

@ -4,7 +4,7 @@
; ;
; par Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;
@ -57,6 +57,7 @@ Toutes ces fonctions peuvent
/renamechar newname : Renomme la personnage et le sauvegarde.
/renamepage name : Renomme la page courante du coffre.
/setindex : La page courante devient un index.
/setmainindex : La page courante devient un index principal.
/resetindex : Retire la page courante des index.
/insertpage : Insère une nouvelle page après la page courante.
/deletepage : Supprime la page courante si elle est vide.
@ -69,6 +70,10 @@ Toutes ces fonctions peuvent
/listcube : (bêta) Crée un fichier "cube.txt" dans le répertoire de sauvegarde contenant toutes les formules actives du cube.
Changements apportés par la v11.02 :
Ajout de la commande /setmainindex : La page courante devient un index principal.
Le nombre de joueurs simulé grace à la commande /players est sauvegardé avec le joueur et réactivé lors du chargement d'une partie. NBPlayersByDefault doit être différent de 0 dans PlugY.ini.
Changements apportés par la v11.01 :
- Ajout de la compatibilité avec la version 1.13d de LOD. (merci à L'Autour)
- Ajout de la commande /unlockmouse : Libère le curseur de la souris de la fenêtre.
@ -510,6 +515,7 @@ Active les nouvelles commandes de PlugY.
/renamechar newname : Renomme la personnage et le sauvegarde. (Vous devez quittez la partie pour mettre à jour la page des stats).
/renamepage name : Renomme la page courante du coffre (MultiStash activé).
/setindex : La page courante devient un index (Les boutons d'index vont jusqu'au prochain index s'il en existe un) (MultiStash activé).
/setmainindex : La page courante devient un index principal (Les boutons d'index +shift vont jusqu'au prochain index s'il en existe un) (MultiStash activé).
/resetindex : Retire la page courante des index (MultiStash activé).
/insertpage : Insère une nouvelle page après la page courante (MultiStash activé).
/deletepage : Supprime la page courante si elle est vide (MultiStash activé).

View File

@ -4,7 +4,7 @@
; ;
; by Yohann Nicolas ;
; ;
; version 11.01 ;
; version 11.02 ;
; ;
;--------------------------------------------------------------------------------------;
@ -54,7 +54,8 @@ Each features can be turn on/off via PlugY.ini (see "COMMENTS ON THE CONFIGURATI
/unlock : Same as /unlockmouse.
/renamechar newname : Rename your character and save it.
/renamepage name : Rename current page stash.
/setindex : Set current stash page as index
/setindex : Set current stash page as index.
/setmainindex : Set current stash page as main index.
/resetindex : Remove index flag on the current stash page.
/insertpage : Insert a new page after the current page.
/deletepage : Delete current page if empty.
@ -67,6 +68,10 @@ Each features can be turn on/off via PlugY.ini (see "COMMENTS ON THE CONFIGURATI
/listcube : (beta) Create a "cube.txt" file in save directory containing all cube's receipts.
v11.02 changes :
Add command /setmainindex : Set the current stash page as main index (shift + prev/next index button go to an main index if exists)
Current number of simulated players use with /players command is save with the player and set on game loading. NBPlayersByDefault must be different to 0 in PlugY.ini.
v11.01 changes :
- Compatibily with 1.13d (thanks to L'Autour)
- Add command /unlockmouse : Unlock the mouse
@ -584,6 +589,7 @@ Activate some new commands in PlugY. In parenthesis is the condition to be able
/renamechar newname : Rename your character and save it. (You must exit the game to update the stats page.)
/renamepage name : Rename current page stash (MultiStash activated).
/setindex : Set current stash page as index (prev/next index button go to an index if exists) (MultiStash activated).
/setmainindex : Set current stash page as main index (shift + prev/next index button go to an main index if exists) (MultiStash activated).
/resetindex : Remove index flag on the current stash page (MultiStash activated).
/insertpage : Insert a new page after the current page (MultiStash activated).
/deletepage : Delete current page if empty (MultiStash activated).

View File

@ -5,25 +5,12 @@
PlugY launcher.
=================================================================*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "../Commons/VersionInfo.h"
#include "PlugYRun.h"
/*
0012C458 00000000 |ModuleFileName = NULL
0012C45C 0012C908 |CommandLine = ""C:\Jeux\Diablo II\Game.exe""
0012C460 00000000 |pProcessSecurity = NULL
0012C464 00000000 |pThreadSecurity = NULL
0012C468 00000000 |InheritHandles = FALSE
0012C46C 04000022 |CreationFlags = DEBUG_ONLY_THIS_PROCESS|NORMAL_PRIORITY_CLASS|CREATE_DEFAULT_ERROR_MODE
0012C470 00000000 |pEnvironment = NULL
0012C474 0012DF94 |CurrentDir = "C:\Jeux\Diablo II\"
0012C478 0012C6BC |pStartupInfo = 0012C6BC
0012C47C 0012C5CC \pProcessInfo = 0012C5CC
*/
#include <stdlib.h>
#include <stdio.h>
#define MAX_LOADSTRING 100
#define SUBKEY "Software\\Blizzard Entertainment\\Diablo II"
@ -44,7 +31,7 @@ BYTE loadDll[] = {
0xFF,0x15,0x40,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.LoadLibraryA>] ; kernel32.LoadLibraryA
0xA3,0xFC,0xEF,0xA8,0x6F, //MOV DWORD PTR DS:[6FA8EFFC],EAX
0x85,0xC0, //TEST EAX,EAX
0x74,0x2F, //JE SHORT d2gfx.6FA7BE37
0x74,0x2B, //JE SHORT d2gfx.6FA7BE33
0x50, //PUSH EAX
0x68,0x90,0xBE,0xA7,0x6F, //PUSH d2gfx.6FA7BE10 ;Init String
0x50, //PUSH EAX
@ -62,13 +49,8 @@ BYTE loadDll[] = {
0x58, //POP EAX
0x58, //POP EAX
0xC2,0x04,0x00, //RETN 4
0x59, //POP ECX
0xB9,0x80,0xBE,0xA7,0x6F, //MOV ECX,d2gfx.6FA7BE80 ; ASCII "PlugY.dll"
0x83,0x04,0x24,0x10, //ADD DWORD PTR SS:[ESP],10
0xC2,0x04,0x00, //RETN 4
0x00,0x00,0x00,0x00 }; //HANDLE var;
BYTE freeDll[] = {
0xFF,0x74,0x24,0x04, //PUSH DWORD PTR SS:[ESP+4]
0xFF,0x15,0x48,0xC0,0xA7,0x6F, //CALL DWORD PTR DS:[<&KERNEL32.FreeLibrary>] ; kernel32.FreeLibrary
@ -94,11 +76,9 @@ BYTE freeDll[] = {
0x58, //POP EAX
0xC2,0x04,0x00 }; //RETN 4
//LPCSTR dllName = "PlugY.dll";
//LPCSTR dllName = "PlugY.dll";
LPCSTR initFctName = "_Init@4";
LPCSTR releaseFctName = "_Release@0";
static bool versionXP;
typedef int(__stdcall* tDebugActiveProcessStop)(DWORD);
tDebugActiveProcessStop debugActiveProcessStop;
@ -124,12 +104,17 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
LPBYTE loadLibraryAddr = addr;
LPBYTE freeLibraryAddr = addr;
LPBYTE getProcAddressAddr = addr;
switch (version)
{
case V107:
loadCallerAddr += 0x3882;
freeCallerAddr += 0x3A6C;
loadLibraryAddr += 0xC038;
freeLibraryAddr += 0xC040;
getProcAddressAddr += 0xC034;
break;
case V108:
//TODO
return false;
case V109:
case V109b:
case V109d:
@ -182,11 +167,27 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
getProcAddressAddr += 0xD120;
break;
case V114a:
loadCallerAddr += 0x1BCB;// Load advapi.dll
freeCallerAddr += 0xF375;// Free dbghelp.dll
loadLibraryAddr += 0x2CD118;
freeLibraryAddr += 0x2CD120;
getProcAddressAddr += 0x2CD11C;
break;
case V114b:
case V114c:
loadCallerAddr += 0x1BCB;// Load advapi.dll
freeCallerAddr += 0x6F75;// Free dbghelp.dll
loadLibraryAddr += 0x2CD11C;
freeLibraryAddr += 0x2CD124;
getProcAddressAddr += 0x2CD120;
break;
case V114d:
//TODO
return false;
loadCallerAddr += 0x621C;// Load advapi.dll
freeCallerAddr += 0xB514;// Free dbghelp.dll
loadLibraryAddr += 0x2CC144;
freeLibraryAddr += 0x2CC14C;
getProcAddressAddr += 0x2CC148;
break;
default:
return false;
}
@ -230,7 +231,6 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
DWORD baseOfCode = *(DWORD*)(buf + 0x2C);
//MessageBox(0, "no memory", "RunPlugY.\n", MB_OK|MB_ICONASTERISK);
//memory = addr + 0xBE00 + isAdd * 0x1000;
memory = addr + baseOfCode + sizeOfCode - 200;
if (!VirtualProtectEx(h, memory, 200, PAGE_EXECUTE_READWRITE, &oldProtect))
assertion("PlugY : Failed to get memory pool in game thread");
@ -271,7 +271,6 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
*(LPBYTE*)&loadDll[33] = initNameAddr;
*(LPBYTE*)&loadDll[40] = getProcAddressAddr;
*(LPBYTE*)&loadDll[63] = getProcAddressAddr;
*(LPBYTE*)&loadDll[80] = dllNameAddr;
len = sizeof(loadDll);
res = WriteProcessMemory(h, loadDllAddr, loadDll, len, &nb);
if (!res || (nb != len)) assertion("PlugY: Write custom data in memory failed");
@ -282,16 +281,14 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
*(LPBYTE*)&freeDll[6] = freeLibraryAddr;
*(LPBYTE*)&freeDll[12] = handleAddr;
*(LPBYTE*)&freeDll[22] = releaseNameAddr;
// *(LPBYTE*)&freeDll[30] = handleAddr;
*(LPBYTE*)&freeDll[36 - 7] = getProcAddressAddr;
*(LPBYTE*)&freeDll[55 - 7] = getProcAddressAddr;
*(LPBYTE*)&freeDll[67 - 7] = freeLibraryAddr;
*(LPBYTE*)&freeDll[29] = getProcAddressAddr;
*(LPBYTE*)&freeDll[48] = getProcAddressAddr;
*(LPBYTE*)&freeDll[60] = freeLibraryAddr;
len = sizeof(freeDll);
res = WriteProcessMemory(h, freeDllAddr, freeDll, len, &nb);
if (!res || (nb != len)) assertion("PlugY: Write custom data in memory failed");
pos += pos % 16 ? len + 16 - pos % 16 : len;
// Patch load library
buf[0] = 0x90;
buf[1] = 0xE8;
@ -305,17 +302,14 @@ bool installPlugY(HANDLE h, LPBYTE addr, char* libraryName, eGameVersion version
res = WriteProcessMemory(h, freeCallerAddr, buf, len, &nb);
if (!res || (nb != len)) assertion("PlugY: Write free library in memory failed");
// if (oldProtect != -1)
// VirtualProtectEx(h,(LPVOID)memory, 200, oldProtect, &oldProtect);
// if (oldProtect != -1)
// VirtualProtectEx(h,(LPVOID)memory, 200, oldProtect, &oldProtect);
return true;
}
//###########################################################################################//
/*bool copyLodVersionFiles()
{
BYTE folder[MAX_PATH];
@ -337,32 +331,43 @@ return true;
#define BUF_SIZE 0x300
bool isD2gfx(HANDLE hProcess, LPVOID dllAdr)
bool isD2gfxLoaded(HANDLE hProcess, LPVOID addr)
{
SIZE_T nbRead;
BYTE buf[BUF_SIZE];
ReadProcessMemory(hProcess, dllAdr, buf, BUF_SIZE, &nbRead);
if (nbRead < 0x40) return false;
int offsetPESignature = *(DWORD*)(buf + 0x3C);
if (offsetPESignature + 38 >= BUF_SIZE) return false;
DWORD baseOfCode = *(DWORD*)(buf + offsetPESignature + 0x34);
if ((baseOfCode != 0x6FA80000) && (baseOfCode != 0x6FA70000)) return false;
return true;
}
bool isGameLoaded(HANDLE hProcess, LPVOID baseAdr)
{
SIZE_T nbRead;
BYTE buf[BUF_SIZE];
ReadProcessMemory(hProcess, baseAdr, buf, BUF_SIZE, &nbRead);
if (nbRead < 0x40) return false;
ReadProcessMemory(hProcess, addr, buf, BUF_SIZE, &nbRead);
if (nbRead < 0x60) return false;
int offsetPESignature = *(DWORD*)(buf + 0x3C);
if (offsetPESignature + 0x5C >= BUF_SIZE) return false;
DWORD baseOfCode = *(DWORD*)(buf + offsetPESignature + 0x34);
DWORD ImageBase = *(DWORD*)(buf + offsetPESignature + 0x34);
DWORD SizeOfImage = *(DWORD*)(buf + offsetPESignature + 0x50);
DWORD CheckSum = *(DWORD*)(buf + offsetPESignature + 0x58);
if ((baseOfCode==0x00400000) && (SizeOfImage == 0x005A5000) && (CheckSum == 0x00374101)) return true;//1.14c
if (ImageBase == 0x6FAA0000 && SizeOfImage == 0x00021000 && CheckSum == 0x00000000) return true;// 1.07 - 1.08
if (ImageBase == 0x6FA70000 && SizeOfImage == 0x00021000 && CheckSum == 0x00000000) return true;// 1.09 - 1.09b - 1.09d - 1.10
if (ImageBase == 0x6FA80000 && SizeOfImage == 0x00021000 && CheckSum == 0x0001743E) return true;// 1.11
if (ImageBase == 0x6FA80000 && SizeOfImage == 0x00021000 && CheckSum == 0x0001F6C4) return true;// 1.11b
if (ImageBase == 0x6FA80000 && SizeOfImage == 0x00021000 && CheckSum == 0x0001F0B2) return true;// 1.12
if (ImageBase == 0x6FA80000 && SizeOfImage == 0x00021000 && CheckSum == 0x0001BE5C) return true;// 1.13c
if (ImageBase == 0x6FA80000 && SizeOfImage == 0x00021000 && CheckSum == 0x00018542) return true;// 1.13d
return false;
}
bool isGameLoaded(HANDLE hProcess, LPVOID addr)
{
SIZE_T nbRead;
BYTE buf[BUF_SIZE];
ReadProcessMemory(hProcess, addr, buf, BUF_SIZE, &nbRead);
if (nbRead < 0x60) return false;
int offsetPESignature = *(DWORD*)(buf + 0x3C);
if (offsetPESignature + 0x5C >= BUF_SIZE) return false;
DWORD ImageBase = *(DWORD*)(buf + offsetPESignature + 0x34);
DWORD SizeOfImage = *(DWORD*)(buf + offsetPESignature + 0x50);
DWORD CheckSum = *(DWORD*)(buf + offsetPESignature + 0x58);
if (ImageBase == 0x00400000 && SizeOfImage == 0x005A6000 && CheckSum == 0x00371D8F) return true;//1.14a
if (ImageBase == 0x00400000 && SizeOfImage == 0x005A6000 && CheckSum == 0x0037645F) return true;//1.14b
if (ImageBase == 0x00400000 && SizeOfImage == 0x005A5000 && CheckSum == 0x00374101) return true;//1.14c
if (ImageBase == 0x00400000 && SizeOfImage == 0x005BA000 && CheckSum == 0x0037CED2) return true;//1.14d
return false;
}
@ -431,20 +436,26 @@ bool launchGame98(LPSTR commandLine, LPSTR currentDirectory, LPSTR libraryName,
if (!GetExitCodeProcess(pi.hProcess, &ret) || (ret != STILL_ACTIVE))
exit(0);
if (isD2gfx(pi.hProcess, (LPVOID)0x6FA80000))
if (isD2gfxLoaded(pi.hProcess, (LPVOID)0x6FA80000))
{
installPlugY(pi.hProcess, (LPBYTE)0x6FA80000, libraryName, version);
ResumeThread(pi.hThread);
return true;
}
if (isD2gfx(pi.hProcess, (LPVOID)0x6FA70000))
if (isD2gfxLoaded(pi.hProcess, (LPVOID)0x6FA70000))
{
installPlugY(pi.hProcess, (LPBYTE)0x6FA70000, libraryName, version);
ResumeThread(pi.hThread);
return true;
}
if (isD2gfxLoaded(pi.hProcess, (LPVOID)0x6FAA0000))
{
installPlugY(pi.hProcess, (LPBYTE)0x6FAA0000, libraryName, version);
ResumeThread(pi.hThread);
// Sleep(10);
return true;
}
ResumeThread(pi.hThread);
//Sleep(10);
}
return false;
}
@ -469,9 +480,9 @@ bool launchGameXP(LPSTR commandLine, LPSTR currentDirectory, LPSTR libraryName,
CloseHandle(DebugEvent.u.CreateThread.hThread);
break;
case CREATE_PROCESS_DEBUG_EVENT:
if (version >= V114a && isGameLoaded(pi.hProcess, DebugEvent.u.CreateProcessInfo.lpBaseOfImage))
if (version >= V114a)// && isGameLoaded(pi.hProcess, DebugEvent.u.CreateProcessInfo.lpBaseOfImage))
{
//installPlugYOnGame(pi.hProcess, (DWORD)DebugEvent.u.CreateProcessInfo.lpBaseOfImage, libraryName, (DWORD)DebugEvent.u.LoadDll.lpBaseOfDll == 0x6FA8000, version);
installPlugY(pi.hProcess, (LPBYTE)DebugEvent.u.CreateProcessInfo.lpBaseOfImage, libraryName, version);
CloseHandle(DebugEvent.u.CreateProcessInfo.hFile);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
@ -486,7 +497,7 @@ bool launchGameXP(LPSTR commandLine, LPSTR currentDirectory, LPSTR libraryName,
MessageBox(0, "EXCEPTION_ACCESS_VIOLATION", "PlugY", MB_OK | MB_ICONASTERISK);
break;
case LOAD_DLL_DEBUG_EVENT:
if (version <= V113d && isD2gfx(pi.hProcess, DebugEvent.u.LoadDll.lpBaseOfDll))
if (version <= V113d && isD2gfxLoaded(pi.hProcess, DebugEvent.u.LoadDll.lpBaseOfDll))
{
installPlugY(pi.hProcess, (LPBYTE)DebugEvent.u.LoadDll.lpBaseOfDll, libraryName, version);
CloseHandle(DebugEvent.u.LoadDll.hFile);
@ -514,8 +525,6 @@ int APIENTRY WinMain (
__in int nShowCmd
)
{
GetD2Version();
char currrentDirectory[MAX_PATH];
char iniFileName[MAX_PATH + sizeof(INIFILE) - 1];
char command[MAX_PATH + sizeof(GAMEFILE) + 200];
@ -592,10 +601,8 @@ int APIENTRY WinMain (
return !launchNormal(command, currrentDirectory);
// Check version
if (version == UNKNOW)
assertion("This LoD version isn't supported by PlugY.");
else if (version < V109 || version > V113d)
assertion("The %s version of LoD isn't supported by PlugY.", GetVersionString(version));
if (version < V107 || version > V114d)
assertion("PlugY isn't compatible with this version : %s", GetVersionString(version));
// Launch LoD and install PlugY
HMODULE module = GetModuleHandle("Kernel32.dll");

Binary file not shown.

Binary file not shown.

View File

@ -160,7 +160,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PlugY.exe&quot;"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;..\PlugYInstaller\PlugY.exe&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>