Web Analytics Made Easy -
StatCounter help with using something in file - CodingForum

Announcement

Collapse
No announcement yet.

help with using something in file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • help with using something in file

    what i want to do is in a file called settings.ini there 3 lines of things
    a dll
    a process
    and a delay

    well what i want it to do is use the name of the dll in a sentance so i can say something like
    the thing you are injecting is (the name of dll in the settings.ini file) i hope you have fun
    but what i want it to do is when someone puts another dll into there it will say that name instead but i dont know how
    well here's the code so far

    Code:
    #include <windows.h>
    #include <iostream>
    #include <string>
    #include <fstream>
    using namespace std;
    
    #include "Injector.h"
    
    string process, dll, delay;
    int rsult = -1;
    
    int main() {
    	ifstream file ("Settings.ini");
    	getline (file,dll);
    	getline (file,process);
    	getline (file,delay);
    	file.close();
        dll = file
    
    
    	cout << "----------------loopy Injector---------------"
    	     << endl
    	     << "----------------Made By loopylukas----------------"
    	     << endl
    	     << endl
    	     << "Waiting for " << process << "...";
    
    	for (;;) {
    		if (IsRunning(process.c_str())) {
    			cout << endl << "Waiting " << delay << " ms" << endl;
    			Sleep (atoi(delay.c_str()));
    			rsult = InjectDll(GetPid(process.c_str()), dll.c_str());
    			break;
    		}
    		cout << ".";
    		Sleep (50);
    	}
    
    	if (rsult == 0) 
    		cout << endl << "Injection Sucess!" << endl;
    	else
    		cout << endl << "Injection Failed!" << endl;
    
    	Sleep (1000);
    	return 0;
    }
    if anyone could help that would be nice
    Last edited by loopylukas; Apr 5, 2009, 08:35 PM.

  • #2
    If you mean you just want to take that line from the string and put it into a sentence it's easy with sprintf_s().

    An example would be:
    Code:
    char someMsg[255] = "";
    char theDLLName[255] = "SomeDLL.dll";
    
    sprintf_s(someMsg, 255, "You have injected %s into the process!", theDLLName);
    Now of course you would have to adjust for your use with the string class, and replace theDLLName with the string you read from the file. Not sure if that's what you meant or not.
    http://www.entangledloops.com

    Comment


    • #3
      hey could you help me place it into my code please?

      Comment


      • #4
        Originally posted by Dunna View Post
        If you mean you just want to take that line from the string and put it into a sentence it's easy with sprintf_s().

        An example would be:
        Code:
        char someMsg[255] = "";
        char theDLLName[255] = "SomeDLL.dll";
        
        sprintf_s(someMsg, 255, "You have injected %s into the process!", theDLLName);
        Now of course you would have to adjust for your use with the string class, and replace theDLLName with the string you read from the file. Not sure if that's what you meant or not.
        I believe the string class has an overload for the insertion operator so you could use that to build the string.
        OracleGuy

        Comment

        Working...
        X