Skip to content

Commit

Permalink
Following discovery of #1 - added warning about running as an admin, …
Browse files Browse the repository at this point in the history
…which is to remain until I can fix the issue
  • Loading branch information
AWilliams17 committed Aug 3, 2019
1 parent 6e833be commit da859d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Binary file modified MonoJabber/.vs/MonoJabber/v15/.suo
Binary file not shown.
Binary file modified MonoJabber/.vs/MonoJabber/v15/Browse.VC.db
Binary file not shown.
13 changes: 10 additions & 3 deletions MonoJabber/MonoJabber/MonoJabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ int main(int argc, char* argv[]) {
);
EndApplication();
}

// Doing this until I can fix https://github.com/AWilliams17/MonoJabber/issues/1
printf(
"\n~~Warning: If this application is run as an administrator, "
"it is possible that it will hang when waiting for the pipe to be connected to from the DLL.~~\n\n"
);
system("pause");

const char *targetProcess = argv[1];
const char *dllPath = argv[2];
Expand Down Expand Up @@ -142,7 +149,7 @@ int main(int argc, char* argv[]) {

bool handleIsValid = mProcessFunctions::mValidateHandle(injecteeHandle);
if (!handleIsValid) {
printf("Error: Failed to get a handle to the target process. Are you running as admin?"
printf("Error: Failed to get a handle to the target process."
"LastErrorCode: %i\n", GetLastError()
);
EndApplication();
Expand All @@ -156,7 +163,7 @@ int main(int argc, char* argv[]) {

// Inject MonoLoaderDLL.dll into the target
if (!mMemoryFunctions::mInjectDLL(targetProcess, monoLoaderDLLPath)) {
printf("Error: Failed to inject MonoLoaderDLL.dll into the target process. Are you running as admin?"
printf("Error: Failed to inject MonoLoaderDLL.dll into the target process."
"LastErrorCode: %i\n", GetLastError()
);
EndApplication();
Expand All @@ -166,7 +173,7 @@ int main(int argc, char* argv[]) {
// Write the parameter struct to the target's memory
LPVOID addressOfParams = VirtualAllocEx(injecteeHandle, NULL, sizeof(LoaderArguments), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
if (!WriteProcessMemory(injecteeHandle, addressOfParams, &lArgs, sizeof(LoaderArguments), 0)) {
printf("Error: WriteProcessMemory returned false. Are you running as admin?"
printf("Error: WriteProcessMemory returned false."
"LastErrorCode: %i\n", GetLastError());
EndApplication();
}
Expand Down

0 comments on commit da859d6

Please sign in to comment.