Classes |
struct | ExchangeData |
Defines |
#define | MODULE "BWAPI.dll" |
Functions |
DWORD | GetRegString (HKEY hBaseKey, const char *pszSubKey, const char *pszValueName, char *pszOutput, DWORD *dwOutSize) |
bool | BWAPIError (DWORD dwErrCode, const char *format,...) |
bool | BWAPIError (const char *format,...) |
BOOL APIENTRY | DllMain (HMODULE, DWORD, LPVOID) |
| __declspec (dllexport) void GetPluginAPI(ExchangeData &Data) |
| sprintf_s (newDescription, 512,"Injects "MODULE" into the Broodwar process.\r\n\r\nRevision %s.\r\nCheck for updates at http://bwapi.googlecode.com/ \r\n\r\nCreated by the BWAPI Project Team", SVN_REV_STR) |
| strcpy (name,"BWAPI Injector ("STARCRAFT_VER") "BUILD_STR) |
| strcpy (description, newDescription) |
| strcpy (updateurl,"http://bwapi.googlecode.com/files/") |
| if (!GetEnvironmentVariable("ChaosDir", envBuffer, MAX_PATH)) |
| strcat (envBuffer,"\\"MODULE) |
| if (dwFileAttribs==INVALID_FILE_ATTRIBUTES||dwFileAttribs &FILE_ATTRIBUTE_DIRECTORY) |
| if (!loadLibAddress) return BWAPIError(GetLastError() |
| if (bytesWritten!=dwDllSize) BWAPIError("WriteToProcessMemory bytesWritten is not the expected value.") |
| if (WaitForSingleObject(hThread, INFINITE)==WAIT_FAILED) |
| if (!GetExitCodeThread(hThread,&dwExitCode)) |
| VirtualFreeEx (hProcess, pathAddress, dwDllSize, MEM_RELEASE) |
| CloseHandle (hThread) |
Variables |
char * | description |
char char *updateurl char | newDescription [512] |
DWORD return | true |
DWORD char | envBuffer [MAX_PATH] |
bool | envFailed = false |
DWORD | dwFileAttribs = GetFileAttributes(envBuffer) |
DWORD | dwDllSize = strlen(envBuffer)+1 |
LPTHREAD_START_ROUTINE | loadLibAddress = (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA" ) |
Could not get Proc Address for | LoadLibraryA |
void * | pathAddress = VirtualAllocEx(hProcess, NULL, dwDllSize, MEM_COMMIT, PAGE_READWRITE) |
Could not allocate memory for DLL | path |
SIZE_T | bytesWritten |
BOOL | success = WriteProcessMemory(hProcess, pathAddress, envBuffer, dwDllSize, &bytesWritten) |
HANDLE | hThread = CreateRemoteThread(hProcess, NULL, 0, loadLibAddress, pathAddress, 0, NULL) |
DWORD | dwExitCode = NULL |
Injection failed nThis is
caused when BWAPI crashes
before injecting | completely |