From: BJ H. <par...@us...> - 2003-10-21 22:20:55
|
Log Message: ----------- QKM improvements? Modified Files: -------------- /cvsroot/decaldev/source/Inject: Manager.cpp Revision Data ------------- Index: Manager.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Inject/Manager.cpp,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- Manager.cpp 20 Oct 2003 18:54:21 -0000 1.79 +++ Manager.cpp 21 Oct 2003 19:12:15 -0000 1.80 @@ -18,6 +18,8 @@ #include "InputBuffer.h" +#include <stdio.h> + const IID EVTID_AcHooks = { 0xEB282FE5, 0x7170, 0x4a37, { 0xA2, 0x6E, 0x92, 0xAF, 0x36, 0x38, 0x5D, 0x2C } }; const IID LIBID_Decal = { 0xFF7F5F6D, 0x34E0, 0x4B6F, { 0xB3, 0xBB, 0x81, 0x41, 0xDE, 0x2E, 0xF7, 0x32 } }; @@ -1292,18 +1294,18 @@ RegKey key; - HANDLE hFile; + //HANDLE hFile; DWORD dwType = REG_EXPAND_SZ; DWORD dwLengthPath = MAX_PATH; DWORD dwLengthMap; - DWORD dwFileSize; - DWORD lpdwBytesRead; + //DWORD dwFileSize; + //DWORD lpdwBytesRead; - int count = 0; + //int count = 0; - char* pDest; - char *pEnd; + //char* pDest; + //char *pEnd; TCHAR tempbuf[MAX_PATH]; TCHAR tempfile[MAX_PATH]; @@ -1330,8 +1332,38 @@ } else return E_FAIL; - ::MessageBox(NULL, tempbuf, "QKM Path", 0); + + //::MessageBox(NULL, tempbuf, "QKM Path", 0); + // The following requires more testing than what i've given it. + FILE * fKeyMap = fopen(tempbuf, "r"); + if (fKeyMap == NULL) + return S_FALSE; + + DWORD dwNumMaps; + fscanf(fKeyMap, "%i\r\n", &dwNumMaps); + + DWORD dwBlah1; + DWORD dwChar; + DWORD dwBlah3; + char szName[256]; + DWORD dwBlah5; + DWORD dwBlah6; + + // Not sure if this method is faster than the code below, + // but it's a bit easier to tell what's going on + while (fscanf(fKeyMap, "%i\t%i\t%i\t%s\t%i\t%i\r\n", &dwBlah1, &dwChar, &dwBlah3, szName, &dwBlah5, &dwBlah6) != 0) + { + if (stricmp(szName, OLE2A(bstrName)) == 0) + break; + + memset(szName, 0, 256); + dwChar = 0; + } + *pAsciiVal = (long)dwChar; + fclose(fKeyMap); + return S_OK; +/* hFile = CreateFile(tempbuf, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if(hFile==INVALID_HANDLE_VALUE) @@ -1380,6 +1412,7 @@ delete[] pBuffer; return S_OK; + */ } STDMETHODIMP cManager::CastSpell(long lSpellID, long lObjectID) |