• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Compiling Plugins give errors each time (1 Viewer)

eqjedi

New member
Joined
Sep 11, 2004
RedCents
Each time I compile a .cpp file for the plugin, there isn't ever a time when I don't get errors or fatal errors. I do everything the guide says up to that point, and i go in-game and try to load it, and it tells me not found. i tried listing, and the /plugin name noauto. it did work for nostun, but in name only. it said it loaded, but i still ended up getting stunned :p

I tried creating and compiling the docrack, but that didnt work in the compiling or loading either. is there a prerequisite i need before making new plugins or did i screw up somewhere?

C:\mq2\mkplugin Docrack

Open MQ2Docrack.vcproj

Open file MQ2Docrack.cpp

highlight all text, and paste the mq2docrack.cpp text in its place

Compile

Description
fatal error C1083: Cannot open include file: 'ByteHandler.h': No such file or directory
File
c:\Mq2\MQ2Docrack\MQ2Docrack.cpp
Line 55

Usually i get more than one, 3 or 4 being average but i figure since this is a good place to start

Other plugins i tried were Warp, Zone, Rwarp, and Nostun

I am a complete n00b at these plugins and I think alot of the tutorial leave alot to be inferred, but its not familiar to me at all so a breakdown of what needs to maybe be done beforehand or something would be great

Please help, as the warp and zone would be dead useful :(
 
I also need some help in this area hehe. Tried compiling a few differnet plugins and got errors everytime. Got pissed off, hit the monitor, threw the chair, and walked away very calmly :D :D :D
BTW anybody know how to fix a monitor that will go black every now and then? Other than hitting it like an old tv I know no other way to fix it lmfao
 
Here is current copy:

bytehandler.h

Rich (BB code):
struct Bytes { 
   vector<BYTE> Normal; 
   vector<BYTE> Crack; 
   DWORD EQADDR; 
}; 

list<Bytes> ByteList; 


class CByteHandler 
{ 
   CHAR szErrorBuffer[MAX_STRING]; 
   CHAR szUnSpacedNormal[MAX_STRING]; 
   CHAR szUnSpacedCrack[MAX_STRING]; 
   CHAR szSpacedNormal[MAX_STRING]; 
   CHAR szSpacedCrack[MAX_STRING]; 
   PCHAR space(PCHAR szSrc, PCHAR szDest); 
   PCHAR unSpace(PCHAR szSrc, PCHAR szDest); 
   void ByteError(PCHAR szFormat, ...); 
   void szStringToVBYTE(PCHAR szString, bool normal); 
   bool bWriteErrors; 
public: 

   Bytes ByteStruct; 
   int NormalByte, CrackByte; 
   bool ProceedWithCrack(bool WriteErrors); 
   bool bProceedWithCrack; 
   CByteHandler(PCHAR szNormal, PCHAR szCrack); 
   CByteHandler(const CByteHandler &ob); 
   ~CByteHandler(); 
}; 



void CByteHandler::ByteError(PCHAR szFormat,...) 
{ 
   bProceedWithCrack = false; 
    va_list vaList; 
    va_start( vaList, szFormat ); 
    vsprintf(szErrorBuffer,szFormat, vaList); 
   if (bWriteErrors) 
      WriteChatColor(szErrorBuffer,CONCOLOR_RED); 
   //FatalError 
   DebugSpewAlways("MQ2DoCrack::ByteError(%s)",szErrorBuffer); 
    

} 

bool CByteHandler::ProceedWithCrack(bool WriteErrors) 
{ 
   bWriteErrors = WriteErrors; 
   if ((strlen(szUnSpacedCrack)%2)) 
      ByteError("Crack Error: Crack information %s is not of an evenly divisable length",szSpacedCrack); 

   if ((strlen(szUnSpacedNormal)%2)) 
      ByteError("Crack Error: Normal information %s is not of an evenly divisable length",szSpacedNormal); 

   if (!strcmp(szUnSpacedNormal,szUnSpacedCrack)) 
      ByteError("Crack Error: Crack and Normal information (%s) are the same",szUnSpacedCrack); 

    
   for (int x=0;x<strlen(szUnSpacedNormal);x++) 
   { 
      if (!isxdigit(szUnSpacedNormal[x])) 
         ByteError("Crack Error: Normal contains non hexadecimal numbers characters in it (%c)",szUnSpacedNormal[x]); 
   } 

   for (x=0;x<strlen(szUnSpacedCrack);x++) 
   { 
      if (!isxdigit(szUnSpacedCrack[x])) 
         ByteError("Crack Error: Crack contains non hexadecimal numbers characters in it (%c)",szUnSpacedCrack[x]); 
   } 

   if (NormalByte != CrackByte) 
      ByteError("Crack Error: Normal/Crack size mismatch: %d/%d bytes",NormalByte,CrackByte); 
   if (!bProceedWithCrack) 
   { 
         ByteError("Normal %s Crack %s",szSpacedNormal,szSpacedCrack); 
         return 0; 
   } 
   else 
      return 1; 
} 

CByteHandler::CByteHandler(PCHAR szNormal, PCHAR szCrack) 
{ 
   bWriteErrors = false;    
   bProceedWithCrack = true; 
   unSpace(szNormal,szUnSpacedNormal); 
   unSpace(szCrack,szUnSpacedCrack); 
   space(szNormal,szSpacedNormal); 
   space(szCrack,szSpacedCrack); 

   NormalByte = ((strlen(szUnSpacedNormal)/2)+(strlen(szUnSpacedNormal)%2)); 
   CrackByte = ((strlen(szUnSpacedCrack)/2)+(strlen(szUnSpacedCrack)%2)); 

   szStringToVBYTE(szUnSpacedNormal,1); 
   szStringToVBYTE(szUnSpacedCrack,0); 

   for (int iByte = 0; iByte+1 < CrackByte; iByte++) 
      if (ByteStruct.Crack[iByte] == ByteStruct.Normal[iByte]) 
         DebugSpewAlways("MQ2DoCrack::CByteHandler::CByteHandler(Crack and Normal at array location %d are the same (0x%x))",(iByte+1),ByteStruct.Normal[iByte]); 
} 

void CByteHandler::szStringToVBYTE(PCHAR szString, bool normal) 
{ 
   char szByte[MAX_STRING] = {0}; 
   DWORD dwPos = 0, dwEnd = strlen(szString); 
    
   while (dwPos < dwEnd) { 
      strcpy(szByte,&szString[dwPos]); 
      szByte[2] = '\0'; 
      if (normal) 
         ByteStruct.Normal.push_back((BYTE)strtoul(szByte, NULL, 16)); 
      else 
         ByteStruct.Crack.push_back((BYTE)strtoul(szByte, NULL, 16)); 
      dwPos = dwPos+2; 
   } 

   return; 
} 

CByteHandler::~CByteHandler() 
{ 
   ByteStruct.Normal.clear(); 
   ByteStruct.Crack.clear(); 
} 

CByteHandler::CByteHandler(const CByteHandler &ob) 
{ 
   ByteStruct.Crack = ob.ByteStruct.Crack; 
   ByteStruct.Normal = ob.ByteStruct.Normal; 
} 

PCHAR CByteHandler::space(PCHAR szSrc, PCHAR szDest) 
{ 
   char *pBuffer=(char*)malloc(MAX_STRING); 
   unSpace(szSrc,pBuffer); 
   char spaceBuffer[MAX_STRING] = {0}; 
   ZeroMemory(szDest,MAX_STRING); 
   for (int h = 0; h<=strlen(szSrc); h=h+2) 
   { 
      ZeroMemory(spaceBuffer,MAX_STRING); 
      for (int o=0;o<2;o++) 
         spaceBuffer[o] = pBuffer[h+o]; 
      if (h>=strlen(szSrc)) break; 
      strcat(spaceBuffer," "); 
      strcat(szDest,spaceBuffer); 
   } 
   free(pBuffer); 
   return szDest; 
} 


PCHAR CByteHandler::unSpace(PCHAR szSrc, PCHAR szDest) 
{ 
    
   char *pBuffer; 
   char spaceBuffer[MAX_STRING] = {0}; 
   ZeroMemory(szDest,MAX_STRING); 
   pBuffer = szSrc; 
   for (int h = 0; h<=strlen(szSrc); h++) 
   { 
      ZeroMemory(spaceBuffer,MAX_STRING); 
      if (szSrc[h] != ' ') //need to put an null term check here? 
      { 
         spaceBuffer[0]=szSrc[h]; 
         strcat(szDest,spaceBuffer); 
      } 
   } 
   return szDest; 
}

------------------------------------------------------------------------

Ok are you using the .NET compiler (set compiler=7 and do everything from a Command Line)? or VC 6++ ?

------------------------------------------------------------------------
First go to /mq2 (or whatever directory you usually compile them in), type in mkplugin mq2docrack (this will make the mq2docrack dir and add a few files there), change directories to there, edit mq2docrack.cpp and paste in the code like you said and save the file.

Next, I like to edit "macroquest2.dsw", simply cut and paste the lines and edit the text you want (e.g.):

Rich (BB code):
###############################################################################
Project: "MQ2Docrack"=.\MQ2Docrack\MQ2Docrack.dsp - Package Owner=<4>

Package=<5>
{{{
}}}

Package=<4>
{{{
    Begin Project Dependency
    Project_Dep_Name MQ2Main
    End Project Dependency
}}}


###############################################################################

This will allow you to compile it directly into your compile each time.
 
I know I sound stupid, and I'd feel retarded if i werent the only one to have this problem.. i cant find bytehandler.h in my MQ2 folder (did a search and browsed to the MQ2 folder). am i supposed to create it seperately, and if so where? i tried searching the forum but i didnt find it using the keyword, which is weird actually since its mentioned here at least @_@

Next, where do I open the text for Macroquest2.dsw? i open the file and no window appears to insert it.. what do i do to get to the place where i insert it? ><

I think I need different files for certain ones such as EQdata.h, because when i tried to make the change the Zone plugin demanded at the plugin creation page. i tried compiling it without doing that and the only error displayed was
error C2039: 'ZoneBoundId" : is not a member of 'EQData::_CHARINFO' c:\Mq2\MQ2Zone\MQ2Zone.cpp Line 22

"in eqdata.h replace"

Code:
/* 0x12e0 */ BYTE Unknown0x12e0[0x14ec-0x12e0];with/* 0x */ BYTE Unknown0xfd8[0x1f8];/* 0x14d8 */ DWORD ZoneBoundId;/* 0x14dc */ BYTE field_0x14dc[0x10];​


Jumjum, my monitor has a similar problem. My monitor takes 5-10 minutes of clicking before the picture appears (and no it wasnt always this way) and if the power goes out, and i restart/reboot, i have to wait all over again, sometimes a little less though. I take it you have a CRT since thats what i have (very expensive 12/03 model too, used in 3d design) but because of this nasty little defect you can find in CRTs from 2000 on, and maybe sooner but I wouldnt know, I'd suggest flat panel, even for a desktop. Thats what im getting

________________ ______________
_| |____________| ____________|
_| |____________| |__________| |
_| |____________| |__________| |
_| |____________| |__________| |
_| |____________| |__________| |
_| /____________|______________|
/__\________________/____\
 
Last edited:
It goes black because I have hit on it so much. Dad thought I busted the screen one day when I lost my temper and punched it. I have a short temper when my macros don't work like there supposed too :eek: :eek:
 
Ok rule one, don't hit the computer cuz lack of your skillz.

MM sounds liek you got all right steps in putting in the plugin cept compiling.

Run : mkplugin in mq2 dir and pick a name bla bla
Example mkplugin iowneq : would create a plugin named MQ2Iowneq in your mq2 folder.

Next screw opening the .dwp file, just open the .ccp, edit it as you see fit, or in your case are told to do so :). Close save. Now open macroquest.dwp in your main mq2 folder. add the project mq2iowneq.dwp to macroquest.dwp, go up to batch build select the new project then build. I usually get no errors. Then remake mq2main.dll. close your ompiler and save all changes to your macroquest.dwp. now run mq2.exe right click your mq2 icon in your system tray and select INI file, scroll down till you see plugin's add at the bottom of that section, mq2iowneq=mq2iowneq. replace your pluign name of course. exit that then save. start up eq, /plugin mq2iowneq
you should be golden, Happy banning.
 
lol how are you even compiling at all then? I got a good set up, can send you mine. its already compiled, but can delete the mq2auth.h file, rerun mq2auth on your pc, then recompile , batch build then build mq2main.dll, then run mq2.exe, u should be set. i got most plugins, /warp/ zone /ghost /docrack
 
sure sounds good.. are you sure you mean dwp? The MQ2 Zip from the download site doesnt have a dwp in it, you mistype?

how do you wanna send it to me? im good on yim, aim, msn(preferred), dc++ or email if you want
 
if you can email it to [email protected], that'd be great


heres what I dont understand though

fatal error C1083: Cannot open include file: 'ByteHandler.h': No such file or directory

File
c:\Mq2\MQ2Docrack\MQ2Docrack.cpp

Line 55


this is before Bytehandler, just for a frame of reference
heres after (displayed on attachment)

also info about MQ2Docrack.h which is displayed, which is completely alien to me since there wasnt a .h file for that created at all. I see the ISXEQDocrack.h, but not for MQ2, and its trying to pull from something that doesnt exist.

Also the perimeters of the Bytehandler.h that czarman gave me up top. it seems it wont read >, <, >=, or <=. I have no idea why this is, and maybe they shouldnt be like that at all, or theres something wrong with my mq2, i dunno i really dont

Also... I dont know what you mean by remake MQ2Main.dll (i have the file lol, but i wouldnt know where to start, tried opening it up in text and was nonchar code. what do i do with the file to remake it?
 
Last edited:
I have Microsoft Visual Studio .NET 2003
well you see, it doesnt create a MQ2Docrack.h. The only .h file it creates automatically is ISXEQDocrack.h. Then I insert bytehandler.h as posted by Czarman, but if you look at the attached thumbnail, there are alot of constraint errors with the >, <, and = stuff, seems to be all that. How do i get MQ2Docrack.h?

Czarman said:
Here is current copy:

bytehandler.h

Rich (BB code):
struct Bytes { 
vector<BYTE> Normal; 
vector<BYTE> Crack; 
DWORD EQADDR; 
}; 
 
list<Bytes> ByteList; 
 
 
class CByteHandler 
{ 
CHAR szErrorBuffer[MAX_STRING]; 
CHAR szUnSpacedNormal[MAX_STRING]; 
CHAR szUnSpacedCrack[MAX_STRING]; 
CHAR szSpacedNormal[MAX_STRING]; 
CHAR szSpacedCrack[MAX_STRING]; 
PCHAR space(PCHAR szSrc, PCHAR szDest); 
PCHAR unSpace(PCHAR szSrc, PCHAR szDest); 
void ByteError(PCHAR szFormat, ...); 
void szStringToVBYTE(PCHAR szString, bool normal); 
bool bWriteErrors; 
public: 
 
Bytes ByteStruct; 
int NormalByte, CrackByte; 
bool ProceedWithCrack(bool WriteErrors); 
bool bProceedWithCrack; 
CByteHandler(PCHAR szNormal, PCHAR szCrack); 
CByteHandler(const CByteHandler &ob); 
~CByteHandler(); 
}; 
 
 
 
void CByteHandler::ByteError(PCHAR szFormat,...) 
{ 
bProceedWithCrack = false; 
va_list vaList; 
va_start( vaList, szFormat ); 
vsprintf(szErrorBuffer,szFormat, vaList); 
if (bWriteErrors) 
WriteChatColor(szErrorBuffer,CONCOLOR_RED); 
//FatalError 
DebugSpewAlways("MQ2DoCrack::ByteError(%s)",szErrorBuffer); 
 
 
} 
 
bool CByteHandler::ProceedWithCrack(bool WriteErrors) 
{ 
bWriteErrors = WriteErrors; 
if ((strlen(szUnSpacedCrack)%2)) 
ByteError("Crack Error: Crack information %s is not of an evenly divisable length",szSpacedCrack); 
 
if ((strlen(szUnSpacedNormal)%2)) 
ByteError("Crack Error: Normal information %s is not of an evenly divisable length",szSpacedNormal); 
 
if (!strcmp(szUnSpacedNormal,szUnSpacedCrack)) 
ByteError("Crack Error: Crack and Normal information (%s) are the same",szUnSpacedCrack); 
 
 
for (int x=0;x<strlen(szUnSpacedNormal);x++) 
{ 
if (!isxdigit(szUnSpacedNormal[x])) 
ByteError("Crack Error: Normal contains non hexadecimal numbers characters in it (%c)",szUnSpacedNormal[x]); 
} 
 
for (x=0;x<strlen(szUnSpacedCrack);x++) 
{ 
if (!isxdigit(szUnSpacedCrack[x])) 
ByteError("Crack Error: Crack contains non hexadecimal numbers characters in it (%c)",szUnSpacedCrack[x]); 
} 
 
if (NormalByte != CrackByte) 
ByteError("Crack Error: Normal/Crack size mismatch: %d/%d bytes",NormalByte,CrackByte); 
if (!bProceedWithCrack) 
{ 
ByteError("Normal %s Crack %s",szSpacedNormal,szSpacedCrack); 
return 0; 
} 
else 
return 1; 
} 
 
CByteHandler::CByteHandler(PCHAR szNormal, PCHAR szCrack) 
{ 
bWriteErrors = false; 
bProceedWithCrack = true; 
unSpace(szNormal,szUnSpacedNormal); 
unSpace(szCrack,szUnSpacedCrack); 
space(szNormal,szSpacedNormal); 
space(szCrack,szSpacedCrack); 
 
NormalByte = ((strlen(szUnSpacedNormal)/2)+(strlen(szUnSpacedNormal)%2)); 
CrackByte = ((strlen(szUnSpacedCrack)/2)+(strlen(szUnSpacedCrack)%2)); 
 
szStringToVBYTE(szUnSpacedNormal,1); 
szStringToVBYTE(szUnSpacedCrack,0); 
 
for (int iByte = 0; iByte+1 < CrackByte; iByte++) 
if (ByteStruct.Crack[iByte] == ByteStruct.Normal[iByte]) 
DebugSpewAlways("MQ2DoCrack::CByteHandler::CByteHandler(Crack and Normal at array location %d are the same (0x%x))",(iByte+1),ByteStruct.Normal[iByte]); 
} 
 
void CByteHandler::szStringToVBYTE(PCHAR szString, bool normal) 
{ 
char szByte[MAX_STRING] = {0}; 
DWORD dwPos = 0, dwEnd = strlen(szString); 
 
while (dwPos < dwEnd) { 
strcpy(szByte,&szString[dwPos]); 
szByte[2] = '\0'; 
if (normal) 
ByteStruct.Normal.push_back((BYTE)strtoul(szByte, NULL, 16)); 
else 
ByteStruct.Crack.push_back((BYTE)strtoul(szByte, NULL, 16)); 
dwPos = dwPos+2; 
} 
 
return; 
} 
 
CByteHandler::~CByteHandler() 
{ 
ByteStruct.Normal.clear(); 
ByteStruct.Crack.clear(); 
} 
 
CByteHandler::CByteHandler(const CByteHandler &ob) 
{ 
ByteStruct.Crack = ob.ByteStruct.Crack; 
ByteStruct.Normal = ob.ByteStruct.Normal; 
} 
 
PCHAR CByteHandler::space(PCHAR szSrc, PCHAR szDest) 
{ 
char *pBuffer=(char*)malloc(MAX_STRING); 
unSpace(szSrc,pBuffer); 
char spaceBuffer[MAX_STRING] = {0}; 
ZeroMemory(szDest,MAX_STRING); 
for (int h = 0; h<=strlen(szSrc); h=h+2) 
{ 
ZeroMemory(spaceBuffer,MAX_STRING); 
for (int o=0;o<2;o++) 
spaceBuffer[o] = pBuffer[h+o]; 
if (h>=strlen(szSrc)) break; 
strcat(spaceBuffer," "); 
strcat(szDest,spaceBuffer); 
} 
free(pBuffer); 
return szDest; 
} 
 
 
PCHAR CByteHandler::unSpace(PCHAR szSrc, PCHAR szDest) 
{ 
 
char *pBuffer; 
char spaceBuffer[MAX_STRING] = {0}; 
ZeroMemory(szDest,MAX_STRING); 
pBuffer = szSrc; 
for (int h = 0; h<=strlen(szSrc); h++) 
{ 
ZeroMemory(spaceBuffer,MAX_STRING); 
if (szSrc[h] != ' ') //need to put an null term check here? 
{ 
spaceBuffer[0]=szSrc[h]; 
strcat(szDest,spaceBuffer); 
} 
} 
return szDest; 
}
gives me all the errors shown in the thumbnail

and of course, the last one is because MQ2docrack.h doesnt exist, because... well it wasnt created
 
Ok so seems like you are missing :

Mq2Docrack.h

INI:
BOOL bInitialized = false; 
void DoCrackHandler(PSPAWNINFO pChar, PCHAR szLine); 
void ShowMemHandler(PSPAWNINFO pChar, PCHAR szLine); 
void DoOffsetHandler(PSPAWNINFO pChar, PCHAR szLine); 

class CDoCrack 
{ 
   typedef char dateString[MAX_STRING]; 


   CHAR szAddr[MAX_STRING]; 
   CHAR szIniKey[MAX_STRING]; 
   CHAR szCrack[MAX_STRING]; 
   CHAR szNormal[MAX_STRING]; 
   CHAR szBuffer[MAX_STRING]; 
   CHAR szTextBuffer[MAX_STRING]; 
   CHAR szAddresses[MAX_STRING]; 
   CHAR szCrackName[MAX_STRING]; 
   CHAR szDescription[MAX_STRING]; 
   CHAR szVersion[MAX_STRING]; 

   DWORD dwAddr; 

   DWORD GetCrackStatus(PCHAR szCrackName); //true if cracked, false if normal or error 
   BOOL DateCheck(PCHAR szApp); 
   VOID Offset(DWORD Address, vector<BYTE> NewData, BOOL Reverse=1); 
   //void LoadOffsets(PCHAR szCrackName); 
   //void WriteOffsets(void); 
public: 
   VOID InitializeCracks(VOID); 
   VOID DoOffset        (PCHAR szLine); 
   VOID DoCrack        (PCHAR szLine); 
   VOID ShowMemory        (PCHAR szLine); 
} DoCrackClass; 


VOID CDoCrack::DoCrack(PCHAR szLine) 
{      
   int iChange = 0, i = 0;//, end; 

   // Parse out the crack name from the command line. 
   GetArg(szCrackName,szLine,1); 

   // If no crack was specified then print the usage string. 
   if( szLine[0]==0 
      || (!strstr(szLine,"list") && !strstr(szLine,"status") 
      && !strstr(szLine,"on") && !strstr(szLine,"off"))) 
   { 
            SyntaxError("Syntax: /docrack <crackname> [on|off|status]"); 
         SyntaxError("Syntax: /docrack list"); 
      return; 
   } 

   // If they want a list of cracks then print it out. 
   // Otherwise preform the requested task. 
   if (!strcmp(szCrackName,"list")) {        
      // Load up the list of cracks available in it .ini file. 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MAX_STRING,INIFileName); 
      CHAR* szCracks = 0; 

      // Print out the crack names one by one. 
      WriteChatColor("Available cracks:",USERCOLOR_DEFAULT); 

      szCracks = szBuffer; 
      for (i=0; i==0 || (szBuffer[i-1]!=0 || szBuffer[i]!=0) ; i++) { 

         if ( szBuffer[i]==0 ) { 
          CHAR szTemp[MAX_STRING] = {0}; 
          sprintf(szTemp, "\t\t%s", szCracks); 
          if( int status = (GetCrackStatus(szCracks) == CRACKSTATUS_ON )){ 
             strcat(szTemp, " on"); 
             WriteChatColor(szTemp, CONCOLOR_GREEN); 
          } else if (status == CRACKSTATUS_OFF){ 
             strcat(szTemp, " off"); 
             WriteChatColor(szTemp, CONCOLOR_BLUE); 
          } else if (status == CRACKSTATUS_ERROR){ 
             strcat(szTemp, " error"); 
             WriteChatColor(szTemp, CONCOLOR_BLUE); 
          } 

            // Set the name pointer to the next position after the null character. 
            szCracks = &szBuffer[i+1]; 
         } 
      } 

      return; 
   } 

   GetPrivateProfileString(szCrackName,NULL,"NULL",szBuffer,MAX_STRING,INIFileName); 
   if (!strcmp(szBuffer,"NULL")) 
   { 
      sprintf(szTextBuffer,"No Ini key found for %s, aborting",szCrackName); 
      WriteChatColor(szTextBuffer,CONCOLOR_RED); 
      return; 
   } 
        
   // Make sure the entry in the .ini file is recent. 
  /* if (!DateCheck(szCrackName)){ 
      WriteChatColor("Date discrepency found, not changing memory"); 
      return; 
   }*/ 
   // Loop through the crack and perform the required action. 
   while(1){ 
       
      sprintf(szAddr,"Address%d",iChange); 
      GetPrivateProfileString(szCrackName,szAddr,"NULL",szBuffer,MAX_STRING,INIFileName); 
       
      if (!strcmp(szBuffer,"NULL")) break; 

      //converts string address to hex 
      dwAddr = strtoul(szBuffer,NULL,16); 

      sprintf(szIniKey,"Crack%d",iChange); 
      GetPrivateProfileString(szCrackName,szIniKey,"NULL",szCrack,MAX_STRING,INIFileName); 
      if (!strcmp(szCrack,"NULL")) { 
         sprintf(szTextBuffer,"Crack error, no associated crack value set with address: 0x%x", dwAddr); 
         WriteChatColor(szTextBuffer ,USERCOLOR_DEFAULT); 
         break; 
      } 
      sprintf(szIniKey,"Normal%d",iChange); 
      GetPrivateProfileString(szCrackName,szIniKey,"NULL",szNormal,MAX_STRING,INIFileName); 
      if (!strcmp(szNormal,"NULL")) { 
         sprintf(szTextBuffer,"Crack error, no associated normal value set with address: 0x%x", dwAddr); 
         WriteChatColor(szTextBuffer ,USERCOLOR_DEFAULT); 
         break; 
      } 
      CByteHandler CBHDoCrack(szNormal,szCrack); 
      if (!CBHDoCrack.ProceedWithCrack(true)) 
      { 
         ByteList.clear(); 
         return; 
      } 

      CBHDoCrack.ByteStruct.EQADDR = dwAddr; 
      ByteList.push_back(CBHDoCrack.ByteStruct); 
      iChange++; 
   } 
    

//feed offsets to write function              
      list<Bytes>::iterator p = ByteList.begin(); 
      // Modify the memory depending on what we need to do. 
       
      if( strstr(szLine,"off") ){ 
         while (p!=ByteList.end()) 
         { 
             
            Offset(p->EQADDR, p->Normal, FALSE); 
            RemoveDetour(p->EQADDR); 
            p++; 
         } 
      } else if( strstr(szLine,"on") ){ 
         // Set the memory to the cracked state. 
         while (p!=ByteList.end()) 
         { 
            AddDetour(p->EQADDR); 
            Offset(p->EQADDR, p->Crack, FALSE); 
            p++; 
         } 
      } 
      ByteList.clear(); 
//end write start information print    

   // Print out what we've done. 
   if( !strstr(szLine, "silent") ) { 
      int GCS = GetCrackStatus(szCrackName); 
      if (GCS==CRACKSTATUS_ON) 
      { 
         GetPrivateProfileString(szCrackName,"Description","NULL",szDescription,MAX_STRING,INIFileName); 
         sprintf(szTextBuffer,"%s: on", szCrackName); 
         WriteChatColor(szTextBuffer, CONCOLOR_GREEN); 
         if (strcmp(szDescription,"NULL")) 
         { 
            sprintf(szTextBuffer,"[%s] %s",szCrackName,szDescription); 
            WriteChatColor(szTextBuffer); 
         } 
      } 
      else if (GCS==CRACKSTATUS_OFF) 
      { 
         sprintf(szTextBuffer,"%s: off", szCrackName); 
         WriteChatColor(szTextBuffer,CONCOLOR_BLUE); 
      } 
      else if (GCS==CRACKSTATUS_ERROR) 
      { 
         sprintf(szTextBuffer,"%s: error!", szCrackName); 
         WriteChatColor(szTextBuffer,CONCOLOR_RED); 
      }        
   } 
   return; 
} 



VOID CDoCrack::Offset(DWORD Address, vector<BYTE> VData, BOOL Reverse) 
{ 
   ZeroMemory(szTextBuffer,MAX_STRING); 
   DWORD i, j, Length = VData.size(); 
   BYTE *NewData = new BYTE [Length]; 
   for (DWORD a = 0;a<Length;a++) 
      NewData[a] = VData[a]; 
    
   DWORD oldperm=0, tmp; 
   if (Reverse && Length>1) 
   { 
      BYTE *szReverse = new BYTE [Length]; 
      for (i = 0, j=Length-1; i < Length; i++,j--) 
      { 
         szReverse[i]=NewData[j]; 
      } 
      memcpy(NewData,szReverse,Length); 
      delete szReverse; 
   } 
   for (DWORD x=0;x<Length;x++) 
   { 
      sprintf(szBuffer,"%x ",NewData[x]); 
      strcat(szTextBuffer,szBuffer); 
   } 
   DebugSpewAlways("MQ2DoCrack::Offset(0x%x,%s)",Address,szTextBuffer); 
    
   FlushInstructionCache(GetCurrentProcess(),(LPCVOID  )Address, Length); 
   VirtualProtectEx(GetCurrentProcess(), (LPVOID)Address, Length,PAGE_EXECUTE_READWRITE, &oldperm); 
   WriteProcessMemory( 
      GetCurrentProcess(), 
      (LPVOID)Address, 
      (LPVOID)NewData, 
      Length, 
      NULL); 
   VirtualProtectEx(GetCurrentProcess(), (LPVOID)Address, Length, oldperm, &tmp); 
    
   delete [] NewData; 
} 


VOID CDoCrack::DoOffset(PCHAR szLine) 
{ 
   if (!szLine[0]) 
   { 
      SyntaxError("Syntax: /dooffset <address> <1 byte of memory|...>"); 
      return; 
   } 
   vector<BYTE> crack; 

   GetArg(szBuffer,szLine,1); 
   DWORD dwAddr = strtoul(szBuffer,NULL,16); 
   if (!dwAddr) 
      return; 

   char *pLine; 
   pLine = &szLine[strlen(szBuffer)]; 
   char *p2, *ptr = pLine; 
   char *end = pLine + strlen(pLine); 

   sprintf(szBuffer,"Command was %X %s",dwAddr,pLine); 
   WriteChatColor(szBuffer,USERCOLOR_DEFAULT); 
    
   AddDetour(dwAddr); 

   while (ptr<end) { 
      crack.push_back((unsigned char)strtol(ptr, &p2, 16)); 
      ptr = p2+1; 
   } 
    
   Offset(dwAddr,crack,FALSE); 
   /*for (int j=0;j<crack.size();j++) 
   { 
      sprintf(szBuffer,"dwAddr: %x with an existing value of %x, cracking with value: %x",(dwAddr+j),*(((LPBYTE)dwAddr)+j),crack[j]); 
      WriteChatColor(szBuffer,USERCOLOR_DEFAULT); 
      Offset((dwAddr+j),crack,1,FALSE); 
   } */ 
} 



BOOL CDoCrack::DateCheck(PCHAR szApp) 
{ 
   dateString szClient[3]; 
   dateString szCrack[3]; 
    
   CHAR szCrackDate[MAX_STRING] = {0}; 

   int d=0; 
   PCHAR szMonth[] = { 
      "Jan",   //0 
      "Feb",   //1 
      "Mar",   //2 
      "Apr",   //3 
      "May",   //4 
      "Jun",   //5 
      "Jul",   //6 
      "Aug",   //7 
      "Sep",   //8 
      "Oct",   //9 
      "Nov",   //10 
      "Dec"    //11 
   }; 


   GetPrivateProfileString(szApp,"Version","NULL",szCrackDate,MAX_STRING,INIFileName); 
   if (!strcmp(szCrackDate,"NULL")) 
   { 
      DebugSpewAlways("MQ2DoCrack::DateCheck(No version key found, going ahead with crack)"); 
      return 1; 
   } 


   //allocate client date information 
   for (int i=0;i<=2;i++) 
   { 
      GetArg(szBuffer,__ExpectedVersionDate,(i+1)); 
      strcpy(szClient[i],szBuffer); 
   } 

   //turn client month in to numeric form 
   for (i=1;i<=12;i++) 
   { 
      if (!strcmp(szClient[0],szMonth[i])) 
         d=i++; 
   } 
   if (d==0) return 0; 

   //allocate crack date information 
   for ( i=0;i<=2;i++) 
   { 
      GetArg(szBuffer,szCrackDate,(i+1),1,0,0,'.'); 
      strcpy(szCrack[i],szBuffer); 
   } 
    
   //compare dates 
   if (atoi(szClient[2])<=atoi(szCrack[0])) 
      if (d<=atoi(szCrack[1])) 
         if (atoi(szClient[1])<=atoi(szCrack[2])) 
            return 1; 
         else return 0; 
      else return 0; 
   else return 0; 
    
} 


VOID CDoCrack::ShowMemory(PCHAR szLine) 
{ 
   if (!szLine[0]) 
   { 
      SyntaxError("Syntax: /showmem <address> <bytes of memory to show>"); 
      return; 
   } 
   int i = 0; 
   GetArg(szAddr,szLine,1); 
   DWORD dwAddr = strtoul(szAddr,NULL,16); 
   if (!dwAddr) 
      return; 
   GetArg(szBuffer,szLine,2); 
    
   if (!(i = atoi(szBuffer))) 
      i=1; 
   for (int j = 0;i>j;j++) 
   { 
      sprintf(szBuffer,"%x ",*(((LPBYTE)dwAddr)+j)); 
      strcat(szTextBuffer,szBuffer); 
   } 
   sprintf(szBuffer,"Memory at %x:",dwAddr); 
   WriteChatColor(szBuffer); 
   WriteChatColor(szTextBuffer); 
   return; 
    

} 

DWORD CDoCrack::GetCrackStatus(PCHAR szCrackName) { 

   int iChange = 0; 
   bool bError = false; 

   while(1) 
   { 
      sprintf(szAddr,"Address%d",iChange); 
      GetPrivateProfileString(szCrackName,szAddr,"NULL",szBuffer,MAX_STRING,INIFileName); 

      if (!strcmp(szBuffer,"NULL")) { 
         if ( iChange==0 ) 
            DebugSpewAlways("MQ2Docrack::GetCrackStatus(No Address key found for %s)",szCrackName); 
         // Return error. 
         return CRACKSTATUS_ERROR; 
      } 
       
      //converts string address to hex 
      dwAddr = strtoul(szBuffer,NULL,16); 
       
      sprintf(szIniKey,"Crack%d",iChange); 
      GetPrivateProfileString(szCrackName,szIniKey,"NULL",szCrack,MAX_STRING,INIFileName); 
      if (!strcmp(szCrack,"NULL")) { 
         DebugSpewAlways("MQ2Docrack::GetCrackStatus([%s] Crack error, no associated crack value set with address: 0x%x)", szCrackName, dwAddr);     
         // Return null. 
         return CRACKSTATUS_ERROR; 
      } 
      sprintf(szIniKey,"Normal%d",iChange); 
      GetPrivateProfileString(szCrackName,szIniKey,"NULL",szNormal,MAX_STRING,INIFileName); 
      if (!strcmp(szNormal,"NULL")) { 
         DebugSpewAlways(szTextBuffer,"MQ2Docrack::GetCrackStatus([%s] Crack error, no associated normal value set with address: 0x%x)", szCrackName, dwAddr); 
         // Return null. 
         return CRACKSTATUS_ERROR; 
      } 
       
      CByteHandler GCS(szNormal, szCrack); 
      if (GCS.ProceedWithCrack(false)) 
         bError = false; 

      for (int iByte = 0;iByte<GCS.NormalByte;iByte++) 
      { 
         if (bError) 
            return CRACKSTATUS_ERROR; 
         else if (*(((LPBYTE)dwAddr)+iByte) == GCS.ByteStruct.Crack[iByte]) 
            return CRACKSTATUS_ON; 
         else if (*(((LPBYTE)dwAddr)+iByte) == GCS.ByteStruct.Normal[iByte]) 
            return CRACKSTATUS_OFF; 
         else 
         {   //problem 
            DebugSpewAlways("MQ2Docrack::GetCrackStatus([%s] Crack warning! No match at addr: 0x%X  [%X/%X])", szCrackName, dwAddr, GCS.ByteStruct.Normal[iByte], GCS.ByteStruct.Crack[iByte]); 
            return CRACKSTATUS_ERROR; 
         } 
      } 
      iChange++; 
   } 
   return 0; 
} 




void CDoCrack::InitializeCracks(void) 
{ 

   if (gGameState==GAMESTATE_INGAME) { 

      bInitialized = true; 

      char szDefaultSetting[MAX_STRING]; 
      char* szSection=0; 
      int i, prev=0, curListIndex=0; 

      // Load the list of cracks from the .ini file. 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MAX_STRING,INIFileName); 

      // Cycle through each of the cracks and set the default value. 
      sprintf(szIniKey,"DefaultSetting"); 
      szSection = szBuffer; 
      for (i=0; i==0 || (szBuffer[i-1]!=0 || szBuffer[i]!=0) ; i++) { 
        
         // If we've reached the end of the section name then process it. 
         if ( szBuffer[i]==0 ) { 

            // Look up the default setting for this entry. 
            GetPrivateProfileString(szSection,szIniKey,"NULL",szDefaultSetting,MAX_STRING,INIFileName);            

            if( strstr(szDefaultSetting, "on") ){ 
               sprintf(szTextBuffer, "%s on silent", szSection); 
               DoCrack(szTextBuffer); 
            } 

            if( strstr(szDefaultSetting, "off") ){ 
               sprintf(szTextBuffer, "%s off silent", szSection); 
               DoCrack(szTextBuffer); 
            } 

            szSection = &szBuffer[i+1]; 
         } 
      } 
   } 

   return; 
}
 
thanks, MQ2Docrack.h had no errors, but I had exactly the same errors, and this time it said I was missing MQ2Crackwnd.h. I went in and checked the .cpp for any other files that may need to be included i missed, and MQ2Crackwnd.h is the last one I need.

Bytehandler still gets the Signed/Unsigned error! Will this disappear when all other files are in place? Could someone give an opinion on it? it seems constant even after the files.

So anyway, can I get MQ2Crackwnd.h. now? im sure its the last one
 
Crackwnd.h

Rich (BB code):
class CDoCrackWnd; 
void CreateDoCrackWindow(); 
void DestroyDoCrackWindow(); 
void ReadWindowINI(PCSIDLWND pWindow); 
void WriteWindowINI(PCSIDLWND pWindow); 
void DoCrackWndCommand(PSPAWNINFO pChar, PCHAR szLine); 
void GetCrackStat(PCHAR szCrackName); 

// CDoCrackWnd window class 
class CDoCrackWnd : public CCustomWnd 
{ 
public: 
   CListWnd *CrackList; 
   CButtonWnd *LoadButton; 

   CDoCrackWnd():CCustomWnd("DoCrackWnd") 
   { 
      CrackList = (CListWnd*)GetChildItem("DC_CrackList"); 
      LoadButton = (CButtonWnd*)GetChildItem("DC_LoadButton"); 
      SetWndNotification(CDoCrackWnd); 
      LoadList(); 
   } 

   ~CDoCrackWnd() 
   { 
   } 

   int WndNotification(CXWnd *pWnd, unsigned int Message, void *unknown) 
   { 
      CHAR szTemp[MAX_STRING]={0}, szBuffer[MAX_STRING]={0}; 

      if (pWnd==(CXWnd*)LoadButton) { 
         if (Message==XWM_LCLICK) { 
            //WriteChatColor("CDoCrackWnd::Button01 LCLICK", USERCOLOR_DEFAULT); 
            this->LoadList(); 
         } else { 
            //DebugSpew("Button01 message %Xh / %d",Message,Message); 
         } 
      } 
      if (pWnd==(CXWnd*)CrackList) { 
         if (Message==XWM_LCLICK) { 
         sprintf(szTemp,"/docrack %s on", GetListItem(szBuffer, (DWORD)(CrackList->GetCurSel()) ) ); 
            //DebugSpewAlways("CDoCrackWnd::CrackList LCLICK Command '%s'", szTemp); 
            DoCommand(NULL, szTemp); 
         } 
         if (Message==XWM_RCLICK) { 
         sprintf(szTemp,"/docrack %s off", GetListItem(szBuffer, (DWORD)(CrackList->GetCurSel()) ) ); 
            //DebugSpewAlways("CDoCrackWnd::CrackList LCLICK Command '%s'", szTemp); 
            DoCommand(NULL, szTemp); 
            LoadList(); 

         } 
         if (Message==XWM_LMOUSEUP) { 
            LoadList();  //refresh status colors after crack select 
         } 
      } 
      return CSidlScreenWnd::WndNotification(pWnd,Message,unkno  wn); 
   }; 

   void LoadList() 
   { 
      char szBuffer[MAX_STRING], szSection[MAX_STRING], szCrackName[MAX_STRING]; 
      int i, prev=0, curListIndex=0; 
      DWORD crack_color; 

      CrackList->DeleteAll(); 

      //DebugSpewAlways("CDoCrackWnd::LoadList(): Get sections list"); 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MA  X_STRING,INIFileName); 

      for (i=0; ((szBuffer != 0) || (szBuffer[i+1] != 0)); i++) { 
         //DebugSpewAlways("LoadList(): cycledsectionbuffer byte %d", i); 

         szSection[i-prev] = szBuffer; 
         if ( szBuffer==0 ) { 
               //DebugSpewAlways("LoadList(): found section %s", szSection); 
               strcpy(szCrackName, szSection); 
               crack_color = GetCrackStatusColor(szCrackName); 

               //DebugSpewAlways("LoadList(): CrackList->AddString(text='%s',crack_color=0x%X)", szCrackName, crack_color); 
               CrackList->AddString(CXStr(szCrackName), crack_color, 0, 0); 

               curListIndex++; 
               prev=i+1; 
            } 
      } 
   } 

   PCHAR GetListItem(PCHAR szFoundName, DWORD dwIndex) 
   { 
      char szBuffer[MAX_STRING], szSection[MAX_STRING]; 
      sprintf(szFoundName, "GetListItem_ERROR"); 
      int i, prev=0; 
      DWORD curListIndex=0; 

      //DebugSpewAlways("CDoCrackWnd::GetListItem(%d): Get sections list", dwIndex); 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MA  X_STRING,INIFileName); 

      for (i=0; ((szBuffer != 0) || (szBuffer[i+1] != 0)); i++) { 
         //DebugSpewAlways("GetListItem(): cycledsectionbuffer byte %d", i); 

         szSection[i-prev] = szBuffer; 
         if ( szBuffer==0 ) { 
               if ( curListIndex == dwIndex ) { 
                  strcpy(szFoundName, szSection); 
                  break; 
               } 
               curListIndex++; 
               prev=i+1; 
            } 
      } 
      //DebugSpewAlways("GetListItem():Return %s", szFoundName); 
      return szFoundName; 
   } 
   DWORD GetCrackStatusColor(PCHAR szCrackName) 
   { 
      CHAR szAddr[MAX_STRING] = {0}; 
      CHAR szIniKey[MAX_STRING] = {0}; 
      CHAR szCrack[MAX_STRING] = {0}; 
      CHAR szNormal[MAX_STRING] = {0}; 
      CHAR szBuffer[MAX_STRING] = {0}; 
      CHAR szTextBuffer[MAX_STRING] = {0}; 
      DWORD dwAddr; 
      int iChange = 0, iByte, iCrackSize; 
      BYTE byCrack[20]; 
      BYTE byNormal[20]; 
      DWORD crack_color; 

      while(1) 
      { 
         sprintf(szAddr,"Address%d",iChange); 
         GetPrivateProfileString(szCrackName,szAddr,"NULL",szBuffer,MAX_STRING,INIFileName); 

         if (!strcmp(szBuffer,"NULL")) 
         { 
            if ( iChange==0 ) 
            { 
               sprintf(szTextBuffer,"GetCrackStatusColor(): no match for '%s'", szCrackName ); 
               crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            } 
            break; 
         } 

         //converts string address to hex 
         dwAddr = strtoul(szBuffer,NULL,16); 

         sprintf(szIniKey,"Crack%d",iChange); 
         GetPrivateProfileString(szCrackName,szIniKey,"NULL",szCrack,MAX_STRING,INIFileName); 
         if (!strcmp(szCrack,"NULL")) 
         { 
            DebugSpewAlways("[%s] Crack error, no associated crack value set with address: 0x%x", szCrackName, dwAddr); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            break; 
         } 
         sprintf(szIniKey,"Normal%d",iChange); 
         GetPrivateProfileString(szCrackName,szIniKey,"NULL",szNormal,MAX_STRING,INIFileName); 
         if (!strcmp(szNormal,"NULL")) 
         { 
            DebugSpewAlways(szTextBuffer,"[%s] Crack error, no associated normal value set with address: 0x%x", szCrackName, dwAddr); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            break; 
         } 

         // convert crack string into actual bytes 
         char *pTempPos, *pCurPos = szCrack; 
         char *pEndCrack = szCrack + strlen(szCrack); 
         iByte = 0; 
         while (pCurPos < pEndCrack) 
         { 
            byCrack[iByte] = (unsigned char)strtol(pCurPos, &pTempPos, 16); 
            iByte++; 
            if (iByte > 20 ) 
            { 
               DebugSpewAlways(szTextBuffer, "[%s] Crack Error: Crack too big.", szCrackName); 
               crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            } 
            pCurPos = pTempPos+1; 
         } 
         iCrackSize = iByte; 

         // convert normal string into actual bytes 
         pCurPos = szNormal; 
         pEndCrack = szNormal + strlen(szNormal); 
         iByte = 0; 
         while (pCurPos < pEndCrack) 
         { 
            byNormal[iByte] = (unsigned char)strtol(pCurPos, &pTempPos, 16); 
            iByte++; 
            pCurPos = pTempPos+1; 
         } 

         if (iByte != iCrackSize) 
         { 
            DebugSpewAlways("[%s] Crack error, crack mismatch crack size: %u  normal size: %u", szCrackName, iCrackSize, iByte); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
         } 

         // look for the first byte that is different in the crack from the normal 
         // should be the 1st byte for gods sake :) 
         for (iByte = 0; iByte < iCrackSize; iByte++) 
         { 
            if (byCrack[iByte] != byNormal[iByte]) 
            break; 
         } 
         if (iByte == iCrackSize) 
         { 
            DebugSpewAlways("[%s] Crack Error: no difference between the crack and normal bytes.", szCrackName); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
         } 

         if (*(((LPBYTE)dwAddr)+iByte) == byCrack[iByte]) 
         { 
            crack_color = ConColorToARGB(CONCOLOR_GREEN);  //on 
         } 
         else if (*(((LPBYTE)dwAddr)+iByte) == byNormal[iByte]) 
         { 
            crack_color = ConColorToARGB(CONCOLOR_BLUE);  //off 
         } 
         else 
         { 
            //problem 
            DebugSpewAlways("[%s] Crack warning! No match at addr: 0x%X  [%X/%X]", szCrackName, dwAddr, byNormal[iByte], byCrack[iByte]); 
            crack_color = ConColorToARGB(CONCOLOR_YELLOW);  //mismatch/warning 
         } 
         iChange++; 
      } 

      return crack_color; 
   } 
}; 
CDoCrackWnd *MyWnd = 0; 


// API are here just to show you where the stuff goes to tie it all together 


PLUGIN_API VOID OnZoned(VOID) 
{ 
   //if you use map enabling in this callback... do it before you call LoadList! 
   if ( gGameState==GAMESTATE_INGAME && MyWnd ) { 
      MyWnd->LoadList();    //can't load UI element lists if SetGameState hasn't loaded them yet 
   } 
} 

// *************************************** 
// DoCrackWnd UI stuff 
// *************************************** 

PLUGIN_API VOID OnCleanUI(VOID) 
{ 
   DebugSpewAlways("MQ2DoCrack::OnCleanUI()"); 
   DestroyDoCrackWindow(); 
} 

PLUGIN_API VOID OnReloadUI(VOID) 
{ 
   DebugSpewAlways("MQ2DoCrack::OnReloadUI()"); 
   CreateDoCrackWindow(); 
} 


CHAR szSettingINISection[MAX_STRING] = {0}; 
void ReadWindowINI(PCSIDLWND pWindow) 
{ 
   //DebugSpewAlways("MQ2DoCrack::ReadWindowINI()"); 
   CHAR Buffer[MAX_STRING] = {0}; 
   sprintf(szSettingINISection,"Settings",((PCHARINFO)pCharData)->Server,((PCHARINFO)pCharData)->Name); 
   pWindow->Location.top      = GetPrivateProfileInt(szSettingINISection,"Top",      401,INIFileName); 
   pWindow->Location.bottom   = GetPrivateProfileInt(szSettingINISection,"Bottom",   723,INIFileName); 
   pWindow->Location.left      = GetPrivateProfileInt(szSettingINISection,"Left",      290,INIFileName); 
   pWindow->Location.right    = GetPrivateProfileInt(szSettingINISection,"Right",      437,INIFileName); 
   pWindow->Locked             = GetPrivateProfileInt(szSettingINISection,"Locked",         0,INIFileName); 
   pWindow->Fades             = GetPrivateProfileInt(szSettingINISection,"Fades",         1,INIFileName); 
   pWindow->TimeMouseOver       = GetPrivateProfileInt(szSettingINISection,"Delay",         2000,INIFileName); 
   pWindow->FadeDuration       = GetPrivateProfileInt(szSettingINISection,"Duration",      500,INIFileName); 
   pWindow->Alpha            = GetPrivateProfileInt(szSettingINISection,"Alpha",         255,INIFileName); 
   pWindow->FadeToAlpha      = GetPrivateProfileInt(szSettingINISection,"FadeToAlpha",   255,INIFileName); 
   pWindow->BGType            = GetPrivateProfileInt(szSettingINISection,"BGType",         1,INIFileName); 
   pWindow->BGColor.R         = GetPrivateProfileInt(szSettingINISection,"BGTint.red",      255,INIFileName); 
   pWindow->BGColor.G         = GetPrivateProfileInt(szSettingINISection,"BGTint.green",   255,INIFileName); 
   pWindow->BGColor.B         = GetPrivateProfileInt(szSettingINISection,"BGTint.blue",   255,INIFileName); 

   GetPrivateProfileString(szSettingINISection,"WindowTitle","MQ2DoCrack",Buffer,MAX_STRING,INIFileName); 
   SetCXStr(&pWindow->WindowText,Buffer); 
} 

void WriteWindowINI(PCSIDLWND pWindow) 
{ 
   //DebugSpewAlways("MQ2DoCrack::WriteWindowINI()"); 
   CHAR szTemp[MAX_STRING] = {0}; 
   if (pWindow->Minimized) 
   { 
      WritePrivateProfileString(szSettingINISection,"Top",      itoa(pWindow->OldLocation.top,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Bottom",   itoa(pWindow->OldLocation.bottom,   szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Left",   itoa(pWindow->OldLocation.left,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Right",   itoa(pWindow->OldLocation.right,   szTemp,10),INIFileName); 
   } 
   else 
   { 
      WritePrivateProfileString(szSettingINISection,"Top",      itoa(pWindow->Location.top,         szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Bottom",   itoa(pWindow->Location.bottom,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Left",   itoa(pWindow->Location.left,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Right",   itoa(pWindow->Location.right,      szTemp,10),INIFileName); 
   } 
   WritePrivateProfileString(szSettingINISection,"Locked",      itoa(pWindow->Locked,         szTemp,10),INIFileName); 

   GetCXStr(pWindow->WindowText,szTemp); 
   WritePrivateProfileString(szSettingINISection,"WindowTitle",                              szTemp,INIFileName); 

   WritePrivateProfileString(szSettingINISection,"Fades",      itoa(pWindow->Fades,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Delay",      itoa(pWindow->MouseOver,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Duration",   itoa(pWindow->FadeDuration,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Alpha",      itoa(pWindow->Alpha,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"FadeToAlpha",   itoa(pWindow->FadeToAlpha,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGType",      itoa(pWindow->BGType,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.red",   itoa(pWindow->BGColor.R,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.green",   itoa(pWindow->BGColor.G,      szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.blue",   itoa(pWindow->BGColor.B,         szTemp,10),INIFileName); 
} 

void CreateDoCrackWindow() 
{ 
   //DebugSpewAlways("MQ2DoCrack::CreateDoCrackWindow()"); 
   if (MyWnd)  return; 

   if (pSidlMgr->FindScreenPieceTemplate("DoCrackWnd")) { 
      MyWnd = new CDoCrackWnd(); 
      ReadWindowINI((PCSIDLWND)MyWnd); 
      WriteWindowINI((PCSIDLWND)MyWnd); 
   } 
} 

void DestroyDoCrackWindow() 
{ 
   //DebugSpewAlways("MQ2DoCrack::DestroyDoCrackWindow()"); 
   if (MyWnd) 
   { 
      WriteWindowINI((PCSIDLWND)MyWnd); 
      delete MyWnd; 
      MyWnd=0; 
   } 
} 

// **************************************************  ************************* 
// Function:      DoCrackWndCommand 
// Description:   How we hide/show our docrack window 
// **************************************************  ************************* 
VOID DoCrackWndCommand(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   if (!MyWnd) { 
      WriteChatColor("/docrackwnd: window init problem",USERCOLOR_DEFAULT); 
      return; 
   } 
    
   if (szLine[0]==0) { 
      WriteChatColor("/docrackwnd: show|hide|load",USERCOLOR_DEFAULT); 
      ((CXWnd*)MyWnd)->Show(1,1); 
      return; 
   } 

   if ( strstr(szLine, "off") || strstr(szLine, "hide") ) { 
      ((CXWnd*)MyWnd)->Show(0,0); 
   } else if ( strstr(szLine, "load") ) { 
      WriteChatColor("/docrackwnd: Reload Cracklist Display",USERCOLOR_DEFAULT); 
      MyWnd->LoadList(); 
      ((CXWnd*)MyWnd)->Show(1,1); 
   } else { 
      ((CXWnd*)MyWnd)->Show(1,1); 
   } 
}


Dunno if the other errors will go away or not.
 
Dont forget the UI file that you need also.

MQUI_DoCrackWnd.xml

Rich (BB code):
<?xml version = "1.0"?> 
<XML ID = "EQInterfaceDefinitionLanguage"> 
   <Schema xmlns = "EverQuestData" xmlns:dt = "EverQuestDataTypes"/> 

   <Listbox item = "DC_CrackList"> 
      <ScreenID>DC_CrackList</ScreenID> 
      <RelativePosition>true</RelativePosition> 
      <AutoStretch>true</AutoStretch> 
      <TopAnchorOffset>2</TopAnchorOffset> 
      <LeftAnchorOffset>2</LeftAnchorOffset> 
      <RightAnchorOffset>2</RightAnchorOffset> 
      <BottomAnchorOffset>24</BottomAnchorOffset> 
      <RightAnchorToLeft>false</RightAnchorToLeft> 
      <BottomAnchorToTop>false</BottomAnchorToTop> 
      <TopAnchorToTop>true</TopAnchorToTop> 
      <LeftAnchorToLeft>true</LeftAnchorToLeft> 

      <DrawTemplate>WDT_Inner</DrawTemplate> 
      <TooltipReference>Crack List</TooltipReference> 
      <TextColor> 
            <R>255</R> 
            <G>255</G> 
            <B>255</B> 
      </TextColor> 
      <Columns> 
         <Width>150</Width> 
      </Columns> 
      <Style_Border>true</Style_Border> 
      <Style_VScroll>true</Style_VScroll> 
   </Listbox> 
    
   <Button item = "DC_LoadButton"> 
      <ScreenID>DC_LoadButton</ScreenID> 
      <Font>1</Font> 
      <RelativePosition>true</RelativePosition> 
      <AutoStretch>true</AutoStretch> 
      <TopAnchorOffset>24</TopAnchorOffset> 
      <LeftAnchorOffset>2</LeftAnchorOffset> 
      <RightAnchorOffset>2</RightAnchorOffset> 
      <BottomAnchorOffset>2</BottomAnchorOffset> 
      <RightAnchorToLeft>false</RightAnchorToLeft> 
      <TopAnchorToBottom>false</TopAnchorToBottom> 
      <BottomAnchorToTop>false</BottomAnchorToTop> 
      <TopAnchorToTop>false</TopAnchorToTop> 
      <BottomAnchorToBottom>true</BottomAnchorToBottom> 
      <LeftAnchorToLeft>true</LeftAnchorToLeft> 
      <RightAnchorToRight>false</RightAnchorToRight> 
      <LeftAnchorToRight>false</LeftAnchorToRight> 

      <Style_Transparent>false</Style_Transparent> 
      <Style_Checkbox>false</Style_Checkbox> 
      <Text>Load INI</Text> 
      <TextColor> 
         <R>10</R> 
         <G>255</G> 
         <B>10</B> 
      </TextColor> 
      <ButtonDrawTemplate> 
         <Normal>A_BtnNormal</Normal> 
         <Pressed>A_BtnPressed</Pressed> 
         <Flyby>A_BtnFlyby</Flyby> 
         <Disabled>A_BtnDisabled</Disabled> 
         <PressedFlyby>A_BtnPressedFlyby</PressedFlyby> 
      </ButtonDrawTemplate> 
   </Button> 

   <Screen item = "DoCrackWnd"> 
      <RelativePosition>false</RelativePosition> 
      <Location> 
         <X>280</X> 
         <Y>280</Y> 
      </Location> 
      <Size> 
         <CX>280</CX> 
         <CY>130</CY> 
      </Size> 
      <Text>MQ2DoCrack</Text> 
      <Style_VScroll>false</Style_VScroll> 
      <Style_HScroll>false</Style_HScroll> 
      <Style_Transparent>false</Style_Transparent> 
      <DrawTemplate>WDT_Def</DrawTemplate> 
      <Style_Titlebar>true</Style_Titlebar> 
      <Style_Closebox>true</Style_Closebox> 
      <Style_Minimizebox>true</Style_Minimizebox> 
      <Style_Border>true</Style_Border> 
      <Style_Sizable>true</Style_Sizable> 
      <Pieces>DC_CrackList</Pieces> 
      <Pieces>DC_LoadButton</Pieces> 
   </Screen> 

</XML>

and edit EQUI.XML and add to the last line with all the Includes:

Rich (BB code):
<Include>MQUI_DoCrackWnd.xml</Include>
 
I THINK I FIXED THE BYTEHANDLER PROBLEM! (I know some others posted the same problem so they'll be stoked hopefully)

Rich (BB code):
struct Bytes { 
vector<BYTE> Normal; 
vector<BYTE> Crack; 
DWORD EQADDR; 
}; 
 
list<Bytes> ByteList; 
 
 
class CByteHandler 
{ 
CHAR szErrorBuffer[MAX_STRING]; 
CHAR szUnSpacedNormal[MAX_STRING]; 
CHAR szUnSpacedCrack[MAX_STRING]; 
CHAR szSpacedNormal[MAX_STRING]; 
CHAR szSpacedCrack[MAX_STRING]; 
PCHAR space(PCHAR szSrc, PCHAR szDest); 
PCHAR unSpace(PCHAR szSrc, PCHAR szDest); 
void ByteError(PCHAR szFormat, ...); 
void szStringToVBYTE(PCHAR szString, bool normal); 
bool bWriteErrors; 
public: 
 
Bytes ByteStruct; 
int NormalByte, CrackByte; 
bool ProceedWithCrack(bool WriteErrors); 
bool bProceedWithCrack; 
CByteHandler(PCHAR szNormal, PCHAR szCrack); 
CByteHandler(const CByteHandler &ob); 
~CByteHandler(); 
}; 
 
 
 
void CByteHandler::ByteError(PCHAR szFormat,...) 
{ 
bProceedWithCrack = false; 
	va_list vaList; 
	va_start( vaList, szFormat ); 
	vsprintf(szErrorBuffer,szFormat, vaList); 
if (bWriteErrors) 
	 WriteChatColor(szErrorBuffer,CONCOLOR_RED); 
//FatalError 
DebugSpewAlways("MQ2DoCrack::ByteError(%s)",szErrorBuffer); 
 
 
} 
 
bool CByteHandler::ProceedWithCrack(bool WriteErrors) 
{ 
bWriteErrors = WriteErrors; 
if ((strlen(szUnSpacedCrack)%2)) 
	 ByteError("Crack Error: Crack information %s is not of an evenly divisable length",szSpacedCrack); 
 
if ((strlen(szUnSpacedNormal)%2)) 
	 ByteError("Crack Error: Normal information %s is not of an evenly divisable length",szSpacedNormal); 
 
if (!strcmp(szUnSpacedNormal,szUnSpacedCrack)) 
	 ByteError("Crack Error: Crack and Normal information (%s) are the same",szUnSpacedCrack); 
 
 
for (int x=0;x=strlen(szUnSpacedNormal);x++) 
{ 
	 if (!isxdigit(szUnSpacedNormal[x])) 
		 ByteError("Crack Error: Normal contains non hexadecimal numbers characters in it (%c)",szUnSpacedNormal[x]); 
} 
 
for (x=0;x=strlen(szUnSpacedCrack);x++) 
{ 
	 if (!isxdigit(szUnSpacedCrack[x])) 
		 ByteError("Crack Error: Crack contains non hexadecimal numbers characters in it (%c)",szUnSpacedCrack[x]); 
} 
 
if (NormalByte != CrackByte) 
	 ByteError("Crack Error: Normal/Crack size mismatch: %d/%d bytes",NormalByte,CrackByte); 
if (!bProceedWithCrack) 
{ 
		 ByteError("Normal %s Crack %s",szSpacedNormal,szSpacedCrack); 
		 return 0; 
} 
else 
	 return 1; 
} 
 
CByteHandler::CByteHandler(PCHAR szNormal, PCHAR szCrack) 
{ 
bWriteErrors = false;	
bProceedWithCrack = true; 
unSpace(szNormal,szUnSpacedNormal); 
unSpace(szCrack,szUnSpacedCrack); 
space(szNormal,szSpacedNormal); 
space(szCrack,szSpacedCrack); 
 
NormalByte = ((strlen(szUnSpacedNormal)/2)+(strlen(szUnSpacedNormal)%2)); 
CrackByte = ((strlen(szUnSpacedCrack)/2)+(strlen(szUnSpacedCrack)%2)); 
 
szStringToVBYTE(szUnSpacedNormal,1); 
szStringToVBYTE(szUnSpacedCrack,0); 
 
for (int iByte = 0; iByte+1 < CrackByte; iByte++) 
	 if (ByteStruct.Crack[iByte] == ByteStruct.Normal[iByte]) 
		 DebugSpewAlways("MQ2DoCrack::CByteHandler::CByteHandler(Crack and Normal at array location %d are the same (0x%x))",(iByte+1),ByteStruct.Normal[iByte]); 
} 
 
void CByteHandler::szStringToVBYTE(PCHAR szString, bool normal) 
{ 
char szByte[MAX_STRING] = {0}; 
DWORD dwPos = 0, dwEnd = strlen(szString); 
 
while (dwPos < dwEnd) { 
	 strcpy(szByte,&szString[dwPos]); 
	 szByte[2] = '\0'; 
	 if (normal) 
		 ByteStruct.Normal.push_back((BYTE)strtoul(szByte, NULL, 16)); 
	 else 
		 ByteStruct.Crack.push_back((BYTE)strtoul(szByte, NULL, 16)); 
	 dwPos = dwPos+2; 
} 
 
return; 
} 
 
CByteHandler::~CByteHandler() 
{ 
ByteStruct.Normal.clear(); 
ByteStruct.Crack.clear(); 
} 
 
CByteHandler::CByteHandler(const CByteHandler &ob) 
{ 
ByteStruct.Crack = ob.ByteStruct.Crack; 
ByteStruct.Normal = ob.ByteStruct.Normal; 
} 
 
PCHAR CByteHandler::space(PCHAR szSrc, PCHAR szDest) 
{ 
char *pBuffer=(char*)malloc(MAX_STRING); 
unSpace(szSrc,pBuffer); 
char spaceBuffer[MAX_STRING] = {0}; 
ZeroMemory(szDest,MAX_STRING); 
for (int h = 0; h=strlen(szSrc); h=h+2) 
{ 
	 ZeroMemory(spaceBuffer,MAX_STRING); 
	 for (int o=0;o<2;o++) 
		 spaceBuffer[o] = pBuffer[h+o]; 
	 if (h=strlen(szSrc)) break; 
	 strcat(spaceBuffer," "); 
	 strcat(szDest,spaceBuffer); 
} 
free(pBuffer); 
return szDest; 
} 
 
 
PCHAR CByteHandler::unSpace(PCHAR szSrc, PCHAR szDest) 
{ 
 
char *pBuffer; 
char spaceBuffer[MAX_STRING] = {0}; 
ZeroMemory(szDest,MAX_STRING); 
pBuffer = szSrc; 
for (int h = 0; h=strlen(szSrc); h++) 
{ 
	 ZeroMemory(spaceBuffer,MAX_STRING); 
	 if (szSrc[h] != ' ') //need to put an null term check here? 
	 { 
		 spaceBuffer[0]=szSrc[h]; 
		 strcat(szDest,spaceBuffer); 
	 } 
} 
return szDest; 
}

Quite simple, i went in and i deleted the > and < at the lines where the errors were for the <= and >=. For the <, I simply changed it to a =. behold, no errors regarding bytehandler.h

But this brings me to my next problem. as a result of crackwnd, i have 2 more errors, shown in thumbnail. the first ones full description is

c:\MQ2\MQ2Docrack\MQ2Crackwnd.h(82): error C2664: 'int EQClasses::CListWnd::AddString(EQClasses::CXStr *,unsigned long,unsigned int,const EQClasses::CTextureAnimation *)' : cannot convert parameter 1 from 'EQClasses::CXStr' to 'EQClasses::CXStr *'

And I have no idea how i'd go about fixing that one

As for the second one.. well Server simply doesnt fit into CHARINFO. How do I get around these two?

Edit: EQUI.xml doesnt exist in my MQ2 folder. where do I add it and whats the code for it?
 
Try my copy, just compiled with it 5 min s ago...

docrackwnd.h

Rich (BB code):
class CDoCrackWnd; 
void CreateDoCrackWindow(); 
void DestroyDoCrackWindow(); 
void ReadWindowINI(PCSIDLWND pWindow); 
void WriteWindowINI(PCSIDLWND pWindow); 
void DoCrackWndCommand(PSPAWNINFO pChar, PCHAR szLine); 
void GetCrackStat(PCHAR szCrackName); 

// CDoCrackWnd window class 
class CDoCrackWnd : public CCustomWnd 
{ 
public: 
   CListWnd *CrackList; 
   CButtonWnd *LoadButton; 

   CDoCrackWnd():CCustomWnd("DoCrackWnd") 
   { 
      CrackList = (CListWnd*)GetChildItem("DC_CrackList"); 
      LoadButton = (CButtonWnd*)GetChildItem("DC_LoadButton"); 
      SetWndNotification(CDoCrackWnd); 
      LoadList(); 
   } 

   ~CDoCrackWnd() 
   { 
   } 

   int WndNotification(CXWnd *pWnd, unsigned int Message, void *unknown) 
   { 
      CHAR szTemp[MAX_STRING]={0}, szBuffer[MAX_STRING]={0}; 

      if (pWnd==(CXWnd*)LoadButton) { 
         if (Message==XWM_LCLICK) { 
            //WriteChatColor("CDoCrackWnd::Button01 LCLICK", USERCOLOR_DEFAULT); 
            this->LoadList(); 
         } else { 
            //DebugSpew("Button01 message %Xh / %d",Message,Message); 
         } 
      } 
      if (pWnd==(CXWnd*)CrackList) { 
         if (Message==XWM_LCLICK) { 
         sprintf(szTemp,"/docrack %s on", GetListItem(szBuffer, (DWORD)(CrackList->GetCurSel()) ) ); 
            //DebugSpewAlways("CDoCrackWnd::CrackList LCLICK Command '%s'", szTemp); 
            DoCommand(NULL, szTemp); 
         } 
         if (Message==XWM_RCLICK) { 
         sprintf(szTemp,"/docrack %s off", GetListItem(szBuffer, (DWORD)(CrackList->GetCurSel()) ) ); 
            //DebugSpewAlways("CDoCrackWnd::CrackList LCLICK Command '%s'", szTemp); 
            DoCommand(NULL, szTemp); 
            LoadList(); 

         } 
         if (Message==XWM_LMOUSEUP) { 
            LoadList();  //refresh status colors after crack select 
         } 
      } 
      return CSidlScreenWnd::WndNotification(pWnd,Message,unknown); 
   }; 

   void LoadList() 
   { 
      char szBuffer[MAX_STRING], szSection[MAX_STRING], szCrackName[MAX_STRING]; 
      int i, prev=0, curListIndex=0; 
      DWORD crack_color; 

      CrackList->DeleteAll(); 

      //DebugSpewAlways("CDoCrackWnd::LoadList(): Get sections list"); 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MAX_STRING,INIFileName); 

      for (i=0; ((szBuffer != 0) || (szBuffer[i+1] != 0)); i++) { 
         //DebugSpewAlways("LoadList(): cycledsectionbuffer byte %d", i); 

         szSection[i-prev] = szBuffer; 
         if ( szBuffer==0 ) { 
               //DebugSpewAlways("LoadList(): found section %s", szSection); 
               strcpy(szCrackName, szSection); 
               crack_color = GetCrackStatusColor(szCrackName); 

               //DebugSpewAlways("LoadList(): CrackList->AddString(text='%s',crack_color=0x%X)", szCrackName, crack_color); 
               CrackList->AddString(&CXStr(szCrackName), crack_color, 0, 0); 

               curListIndex++; 
               prev=i+1; 
            } 
      } 
   } 

   PCHAR GetListItem(PCHAR szFoundName, DWORD dwIndex) 
   { 
      char szBuffer[MAX_STRING], szSection[MAX_STRING]; 
      sprintf(szFoundName, "GetListItem_ERROR"); 
      int i, prev=0; 
      DWORD curListIndex=0; 

      //DebugSpewAlways("CDoCrackWnd::GetListItem(%d): Get sections list", dwIndex); 
      GetPrivateProfileString(NULL,NULL,NULL,szBuffer,MAX_STRING,INIFileName); 

      for (i=0; ((szBuffer != 0) || (szBuffer[i+1] != 0)); i++) { 
         //DebugSpewAlways("GetListItem(): cycledsectionbuffer byte %d", i); 

         szSection[i-prev] = szBuffer; 
         if ( szBuffer==0 ) { 
               if ( curListIndex == dwIndex ) { 
                  strcpy(szFoundName, szSection); 
                  break; 
               } 
               curListIndex++; 
               prev=i+1; 
            } 
      } 
      //DebugSpewAlways("GetListItem():Return %s", szFoundName); 
      return szFoundName; 
   } 
   DWORD GetCrackStatusColor(PCHAR szCrackName) 
   { 
      CHAR szAddr[MAX_STRING] = {0}; 
      CHAR szIniKey[MAX_STRING] = {0}; 
      CHAR szCrack[MAX_STRING] = {0}; 
      CHAR szNormal[MAX_STRING] = {0}; 
      CHAR szBuffer[MAX_STRING] = {0}; 
      CHAR szTextBuffer[MAX_STRING] = {0}; 
      DWORD dwAddr; 
      int iChange = 0, iByte, iCrackSize; 
      BYTE byCrack[20]; 
      BYTE byNormal[20]; 
      DWORD crack_color; 

      while(1) 
      { 
         sprintf(szAddr,"Address%d",iChange); 
         GetPrivateProfileString(szCrackName,szAddr,"NULL",szBuffer,MAX_STRING,INIFileName); 

         if (!strcmp(szBuffer,"NULL")) 
         { 
            if ( iChange==0 ) 
            { 
               sprintf(szTextBuffer,"GetCrackStatusColor(): no match for '%s'", szCrackName ); 
               crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            } 
            break; 
         } 

         //converts string address to hex 
         dwAddr = strtoul(szBuffer,NULL,16); 

         sprintf(szIniKey,"Crack%d",iChange); 
         GetPrivateProfileString(szCrackName,szIniKey,"NULL",szCrack,MAX_STRING,INIFileName); 
         if (!strcmp(szCrack,"NULL")) 
         { 
            DebugSpewAlways("[%s] Crack error, no associated crack value set with address: 0x%x", szCrackName, dwAddr); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            break; 
         } 
         sprintf(szIniKey,"Normal%d",iChange); 
         GetPrivateProfileString(szCrackName,szIniKey,"NULL",szNormal,MAX_STRING,INIFileName); 
         if (!strcmp(szNormal,"NULL")) 
         { 
            DebugSpewAlways(szTextBuffer,"[%s] Crack error, no associated normal value set with address: 0x%x", szCrackName, dwAddr); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            break; 
         } 

         // convert crack string into actual bytes 
         char *pTempPos, *pCurPos = szCrack; 
         char *pEndCrack = szCrack + strlen(szCrack); 
         iByte = 0; 
         while (pCurPos < pEndCrack) 
         { 
            byCrack[iByte] = (unsigned char)strtol(pCurPos, &pTempPos, 16); 
            iByte++; 
            if (iByte > 20 ) 
            { 
               DebugSpewAlways(szTextBuffer, "[%s] Crack Error: Crack too big.", szCrackName); 
               crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
            } 
            pCurPos = pTempPos+1; 
         } 
         iCrackSize = iByte; 

         // convert normal string into actual bytes 
         pCurPos = szNormal; 
         pEndCrack = szNormal + strlen(szNormal); 
         iByte = 0; 
         while (pCurPos < pEndCrack) 
         { 
            byNormal[iByte] = (unsigned char)strtol(pCurPos, &pTempPos, 16); 
            iByte++; 
            pCurPos = pTempPos+1; 
         } 

         if (iByte != iCrackSize) 
         { 
            DebugSpewAlways("[%s] Crack error, crack mismatch crack size: %u  normal size: %u", szCrackName, iCrackSize, iByte); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
         } 

         // look for the first byte that is different in the crack from the normal 
         // should be the 1st byte for gods sake :) 
         for (iByte = 0; iByte < iCrackSize; iByte++) 
         { 
            if (byCrack[iByte] != byNormal[iByte]) 
            break; 
         } 
         if (iByte == iCrackSize) 
         { 
            DebugSpewAlways("[%s] Crack Error: no difference between the crack and normal bytes.", szCrackName); 
            crack_color = ConColorToARGB(CONCOLOR_RED);  //data error 
         } 

         if (*(((LPBYTE)dwAddr)+iByte) == byCrack[iByte]) 
         { 
            crack_color = ConColorToARGB(CONCOLOR_GREEN);  //on 
         } 
         else if (*(((LPBYTE)dwAddr)+iByte) == byNormal[iByte]) 
         { 
            crack_color = ConColorToARGB(CONCOLOR_BLUE);  //off 
         } 
         else 
         { 
            //problem 
            DebugSpewAlways("[%s] Crack warning! No match at addr: 0x%X  [%X/%X]", szCrackName, dwAddr, byNormal[iByte], byCrack[iByte]); 
            crack_color = ConColorToARGB(CONCOLOR_YELLOW);  //mismatch/warning 
         } 
         iChange++; 
      } 

      return crack_color; 
   } 
}; 
CDoCrackWnd *MyWnd = 0; 


// API are here just to show you where the stuff goes to tie it all together 


PLUGIN_API VOID OnZoned(VOID) 
{ 
   //if you use map enabling in this callback... do it before you call LoadList! 
   if ( gGameState==GAMESTATE_INGAME && MyWnd ) { 
      MyWnd->LoadList();    //can't load UI element lists if SetGameState hasn't loaded them yet 
   } 
} 

// *************************************** 
// DoCrackWnd UI stuff 
// *************************************** 

PLUGIN_API VOID OnCleanUI(VOID) 
{ 
   DebugSpewAlways("MQ2DoCrack::OnCleanUI()"); 
   DestroyDoCrackWindow(); 
} 

PLUGIN_API VOID OnReloadUI(VOID) 
{ 
   DebugSpewAlways("MQ2DoCrack::OnReloadUI()"); 
   CreateDoCrackWindow(); 
} 


CHAR szSettingINISection[MAX_STRING] = {0}; 
void ReadWindowINI(PCSIDLWND pWindow) 
{ 
   //DebugSpewAlways("MQ2DoCrack::ReadWindowINI()"); 
   CHAR Buffer[MAX_STRING] = {0}; 
   sprintf(szSettingINISection,"Settings",EQADDR_SERVERNAME,((PCHARINFO)pCharData)->Name); 
   pWindow->Location.top      = GetPrivateProfileInt(szSettingINISection,"Top",      401,INIFileName); 
   pWindow->Location.bottom   = GetPrivateProfileInt(szSettingINISection,"Bottom",   723,INIFileName); 
   pWindow->Location.left      = GetPrivateProfileInt(szSettingINISection,"Left",      290,INIFileName); 
   pWindow->Location.right    = GetPrivateProfileInt(szSettingINISection,"Right",      437,INIFileName); 
   pWindow->Locked             = GetPrivateProfileInt(szSettingINISection,"Locked",         0,INIFileName); 
   pWindow->Fades             = GetPrivateProfileInt(szSettingINISection,"Fades",         1,INIFileName); 
   pWindow->TimeMouseOver       = GetPrivateProfileInt(szSettingINISection,"Delay",         2000,INIFileName); 
   pWindow->FadeDuration       = GetPrivateProfileInt(szSettingINISection,"Duration",      500,INIFileName); 
   pWindow->Alpha            = GetPrivateProfileInt(szSettingINISection,"Alpha",         255,INIFileName); 
   pWindow->FadeToAlpha      = GetPrivateProfileInt(szSettingINISection,"FadeToAlpha",   255,INIFileName); 
   pWindow->BGType            = GetPrivateProfileInt(szSettingINISection,"BGType",         1,INIFileName); 
   pWindow->BGColor.R         = GetPrivateProfileInt(szSettingINISection,"BGTint.red",      255,INIFileName); 
   pWindow->BGColor.G         = GetPrivateProfileInt(szSettingINISection,"BGTint.green",   255,INIFileName); 
   pWindow->BGColor.B         = GetPrivateProfileInt(szSettingINISection,"BGTint.blue",   255,INIFileName); 

   GetPrivateProfileString(szSettingINISection,"WindowTitle","MQ2DoCrack",Buffer,MAX_STRING,INIFileName); 
   SetCXStr(&pWindow->WindowText,Buffer); 
} 

void WriteWindowINI(PCSIDLWND pWindow) 
{ 
   //DebugSpewAlways("MQ2DoCrack::WriteWindowINI()"); 
   CHAR szTemp[MAX_STRING] = {0}; 
   if (pWindow->Minimized) 
   { 
      WritePrivateProfileString(szSettingINISection,"Top",      itoa(pWindow->OldLocation.top,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Bottom",   itoa(pWindow->OldLocation.bottom,   szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Left",   itoa(pWindow->OldLocation.left,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Right",   itoa(pWindow->OldLocation.right,   szTemp,10),INIFileName); 
   } 
   else 
   { 
      WritePrivateProfileString(szSettingINISection,"Top",      itoa(pWindow->Location.top,         szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Bottom",   itoa(pWindow->Location.bottom,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Left",   itoa(pWindow->Location.left,      szTemp,10),INIFileName); 
      WritePrivateProfileString(szSettingINISection,"Right",   itoa(pWindow->Location.right,      szTemp,10),INIFileName); 
   } 
   WritePrivateProfileString(szSettingINISection,"Locked",      itoa(pWindow->Locked,         szTemp,10),INIFileName); 

   GetCXStr(pWindow->WindowText,szTemp); 
   WritePrivateProfileString(szSettingINISection,"WindowTitle",                              szTemp,INIFileName); 

   WritePrivateProfileString(szSettingINISection,"Fades",      itoa(pWindow->Fades,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Delay",      itoa(pWindow->MouseOver,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Duration",   itoa(pWindow->FadeDuration,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"Alpha",      itoa(pWindow->Alpha,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"FadeToAlpha",   itoa(pWindow->FadeToAlpha,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGType",      itoa(pWindow->BGType,            szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.red",   itoa(pWindow->BGColor.R,         szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.green",   itoa(pWindow->BGColor.G,      szTemp,10),INIFileName); 
   WritePrivateProfileString(szSettingINISection,"BGTint.blue",   itoa(pWindow->BGColor.B,         szTemp,10),INIFileName); 
} 

void CreateDoCrackWindow() 
{ 
   //DebugSpewAlways("MQ2DoCrack::CreateDoCrackWindow()"); 
   if (MyWnd)  return; 

   if (pSidlMgr->FindScreenPieceTemplate("DoCrackWnd")) { 
      MyWnd = new CDoCrackWnd(); 
      ReadWindowINI((PCSIDLWND)MyWnd); 
      WriteWindowINI((PCSIDLWND)MyWnd); 
   } 
} 

void DestroyDoCrackWindow() 
{ 
   //DebugSpewAlways("MQ2DoCrack::DestroyDoCrackWindow()"); 
   if (MyWnd) 
   { 
      WriteWindowINI((PCSIDLWND)MyWnd); 
      delete MyWnd; 
      MyWnd=0; 
   } 
} 

// **************************************************  ************************* 
// Function:      DoCrackWndCommand 
// Description:   How we hide/show our docrack window 
// **************************************************  ************************* 
VOID DoCrackWndCommand(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   if (!MyWnd) { 
      WriteChatColor("/docrackwnd: window init problem",USERCOLOR_DEFAULT); 
      return; 
   } 
    
   if (szLine[0]==0) { 
      WriteChatColor("/docrackwnd: show|hide|load",USERCOLOR_DEFAULT); 
      ((CXWnd*)MyWnd)->Show(1,1); 
      return; 
   } 

   if ( strstr(szLine, "off") || strstr(szLine, "hide") ) { 
      ((CXWnd*)MyWnd)->Show(0,0); 
   } else if ( strstr(szLine, "load") ) { 
      WriteChatColor("/docrackwnd: Reload Cracklist Display",USERCOLOR_DEFAULT); 
      MyWnd->LoadList(); 
      ((CXWnd*)MyWnd)->Show(1,1); 
   } else { 
      ((CXWnd*)MyWnd)->Show(1,1); 
   } 
}



Bytehandler.h (latest version) compiled at work using VS.NET (VC++ at home)

INI:
struct Bytes { 
   vector<BYTE> Normal; 
   vector<BYTE> Crack; 
   DWORD EQADDR; 
}; 

list<Bytes> ByteList; 


class CByteHandler 
{ 
   CHAR szErrorBuffer[MAX_STRING]; 
   CHAR szUnSpacedNormal[MAX_STRING]; 
   CHAR szUnSpacedCrack[MAX_STRING]; 
   CHAR szSpacedNormal[MAX_STRING]; 
   CHAR szSpacedCrack[MAX_STRING]; 
   PCHAR space(PCHAR szSrc, PCHAR szDest); 
   PCHAR unSpace(PCHAR szSrc, PCHAR szDest); 
   void ByteError(PCHAR szFormat, ...); 
   void szStringToVBYTE(PCHAR szString, bool normal); 
   bool bWriteErrors; 
public: 

   Bytes ByteStruct; 
   int NormalByte, CrackByte; 
   bool ProceedWithCrack(bool WriteErrors); 
   bool bProceedWithCrack; 
   CByteHandler(PCHAR szNormal, PCHAR szCrack); 
   CByteHandler(const CByteHandler &ob); 
   ~CByteHandler(); 
}; 



void CByteHandler::ByteError(PCHAR szFormat,...) 
{ 
   bProceedWithCrack = false; 
    va_list vaList; 
    va_start( vaList, szFormat ); 
    vsprintf(szErrorBuffer,szFormat, vaList); 
   if (bWriteErrors) 
      WriteChatColor(szErrorBuffer,CONCOLOR_RED); 
   //FatalError 
   DebugSpewAlways("MQ2DoCrack::ByteError(%s)",szErrorBuffer); 
    

} 

bool CByteHandler::ProceedWithCrack(bool WriteErrors) 
{ 
   bWriteErrors = WriteErrors; 
   if ((strlen(szUnSpacedCrack)%2)) 
      ByteError("Crack Error: Crack information %s is not of an evenly divisable length",szSpacedCrack); 

   if ((strlen(szUnSpacedNormal)%2)) 
      ByteError("Crack Error: Normal information %s is not of an evenly divisable length",szSpacedNormal); 

   if (!strcmp(szUnSpacedNormal,szUnSpacedCrack)) 
      ByteError("Crack Error: Crack and Normal information (%s) are the same",szUnSpacedCrack); 

    
   for (int x=0;x<strlen(szUnSpacedNormal);x++) 
   { 
      if (!isxdigit(szUnSpacedNormal[x])) 
         ByteError("Crack Error: Normal contains non hexadecimal numbers characters in it (%c)",szUnSpacedNormal[x]); 
   } 

   for (x=0;x<strlen(szUnSpacedCrack);x++) 
   { 
      if (!isxdigit(szUnSpacedCrack[x])) 
         ByteError("Crack Error: Crack contains non hexadecimal numbers characters in it (%c)",szUnSpacedCrack[x]); 
   } 

   if (NormalByte != CrackByte) 
      ByteError("Crack Error: Normal/Crack size mismatch: %d/%d bytes",NormalByte,CrackByte); 
   if (!bProceedWithCrack) 
   { 
         ByteError("Normal %s Crack %s",szSpacedNormal,szSpacedCrack); 
         return 0; 
   } 
   else 
      return 1; 
} 

CByteHandler::CByteHandler(PCHAR szNormal, PCHAR szCrack) 
{ 
   bWriteErrors = false;    
   bProceedWithCrack = true; 
   unSpace(szNormal,szUnSpacedNormal); 
   unSpace(szCrack,szUnSpacedCrack); 
   space(szNormal,szSpacedNormal); 
   space(szCrack,szSpacedCrack); 

   NormalByte = ((strlen(szUnSpacedNormal)/2)+(strlen(szUnSpacedNormal)%2)); 
   CrackByte = ((strlen(szUnSpacedCrack)/2)+(strlen(szUnSpacedCrack)%2)); 

   szStringToVBYTE(szUnSpacedNormal,1); 
   szStringToVBYTE(szUnSpacedCrack,0); 

   for (int iByte = 0; iByte+1 < CrackByte; iByte++) 
      if (ByteStruct.Crack[iByte] == ByteStruct.Normal[iByte]) 
         DebugSpewAlways("MQ2DoCrack::CByteHandler::CByteHandler(Crack and Normal at array location %d are the same (0x%x))",(iByte+1),ByteStruct.Normal[iByte]); 
} 

void CByteHandler::szStringToVBYTE(PCHAR szString, bool normal) 
{ 
   char szByte[MAX_STRING] = {0}; 
   DWORD dwPos = 0, dwEnd = strlen(szString); 
    
   while (dwPos < dwEnd) { 
      strcpy(szByte,&szString[dwPos]); 
      szByte[2] = '\0'; 
      if (normal) 
         ByteStruct.Normal.push_back((BYTE)strtoul(szByte, NULL, 16)); 
      else 
         ByteStruct.Crack.push_back((BYTE)strtoul(szByte, NULL, 16)); 
      dwPos = dwPos+2; 
   } 

   return; 
} 

CByteHandler::~CByteHandler() 
{ 
   ByteStruct.Normal.clear(); 
   ByteStruct.Crack.clear(); 
} 

CByteHandler::CByteHandler(const CByteHandler &ob) 
{ 
   ByteStruct.Crack = ob.ByteStruct.Crack; 
   ByteStruct.Normal = ob.ByteStruct.Normal; 
} 

PCHAR CByteHandler::space(PCHAR szSrc, PCHAR szDest) 
{ 
   char *pBuffer=(char*)malloc(MAX_STRING); 
   unSpace(szSrc,pBuffer); 
   char spaceBuffer[MAX_STRING] = {0}; 
   ZeroMemory(szDest,MAX_STRING); 
   for (int h = 0; h<=strlen(szSrc); h=h+2) 
   { 
      ZeroMemory(spaceBuffer,MAX_STRING); 
      for (int o=0;o<2;o++) 
         spaceBuffer[o] = pBuffer[h+o]; 
      if (h>=strlen(szSrc)) break; 
      strcat(spaceBuffer," "); 
      strcat(szDest,spaceBuffer); 
   } 
   free(pBuffer); 
   return szDest; 
} 


PCHAR CByteHandler::unSpace(PCHAR szSrc, PCHAR szDest) 
{ 
    
   char *pBuffer; 
   char spaceBuffer[MAX_STRING] = {0}; 
   ZeroMemory(szDest,MAX_STRING); 
   pBuffer = szSrc; 
   for (int h = 0; h<=strlen(szSrc); h++) 
   { 
      ZeroMemory(spaceBuffer,MAX_STRING); 
      if (szSrc[h] != ' ') //need to put an null term check here? 
      { 
         spaceBuffer[0]=szSrc[h]; 
         strcat(szDest,spaceBuffer); 
      } 
   } 
   return szDest; 
}
 
Compiling Plugins give errors each time

Users who are viewing this thread

Back
Top