Creating window from successful DLL attachment

Posts 1–4 of 4 · Page 1 of 1
Creating window from successful DLL attachment
YES! I'm trying to do what GG Trainer in the Maple Story section does. Yep. I'm a copycat.

So does it pretty much run a normal Windows procedure on successful attach, or how much more condensed is it, if at all possible? I've SEEN what it can do, but, the internet(people on it) say a window cannot be created from a DLL. So I hope I'm right and not blind.

What do I need to do? I'm learning and playing with the windows part now, I've kinda made an address modifier for a game(didn't work perfectly, but compiled and I understood it. I lack a pointer scanner for it).

Teach, please.
Quote Originally Posted by NathanV2 View Post
msdn.microsoft.com/en-us/librarydows/desktop/ms645505(v=vs.85).aspx ?
kinda..?
maybe i'm not reading that article deeply enough. i'm talking about the entirely in-depth "I can do lots of things with this window"..not really a confirm/deny popup window.

edit: well if i could get one of those windows to pop up and allow text input, that might work..but i'd still like to know how GG v2 trainer does it's flippin sweet window.
Code:
HWND myDialog;
HWND editBox;

void createWindow()
{
	myDialog = CreateWindowEx(0, WC_DIALOG,"Just a random window",WS_OVERLAPPEDWINDOW | WS_VISIBLE,	400,100,800,380,NULL,NULL,NULL,NULL	);

	CreateWindow( "listbox", "",
		WS_VISIBLE|WS_CHILD|LBS_HASSTRINGS|WS_HSCROLL|WS_VSCROLL,
		0, 0, 780, 300, myDialog, (HMENU)156, 0, NULL);

	editBox = CreateWindow( "edit", "",
		WS_VISIBLE|WS_CHILD,
		0, 305, 780, 20, myDialog, (HMENU)158, 0, NULL);
}

DWORD WINAPI mySexyThread( LPVOID lpParam )
{
	while(1)
	{
		MSG msg;
		if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
		{
			if(msg.hwnd == editBox && msg.message == WM_KEYDOWN && msg.wParam == VK_RETURN)
			{
				int len = GetWindowTextLength(editBox);
				char *tmp = new char[len+1];
				GetWindowText(editBox, tmp, len+1);
				string tmps(tmp);
				if(tmps.find(" ") == string::npos)
				{
					if(cvar->FindVar(tmp) != NULL)
					{
						int selpos = SendDlgItemMessage(myDialog, 156, LB_ADDSTRING, 0, (LPARAM)tmp);
						SendDlgItemMessage(myDialog, 156, LB_SETCURSEL, selpos, 0);
						char tbuff[512] = "";
						sprintf(tbuff, "\"%s\" = \"%s\" (def. \"%s\")", tmp, cvar->FindVar(tmp)->GetString(), cvar->FindVar(tmp)->m_pszDefaultValue);
						selpos = SendDlgItemMessage(myDialog, 156, LB_ADDSTRING, 0, (LPARAM)tbuff);
						SendDlgItemMessage(myDialog, 156, LB_SETCURSEL, selpos, 0);
					}
				}
			}
		}
		Sleep(1);
        }
}

dllmain DLL_PROCESS_ATTACH:
createWindow();
CreateThread(0, 0, &mySexyThread, 0, 0, 0);
it peeks in the message buffer but doesn't remove the message(so the application injected into will still have to handle those), you might be able to use PM_REMOVE for some applications without anything breaking(this was the case for vindictus), or peekmessage with PM_NOREMOVE and if it's supposed to go to your window peekmessage with PM_REMOVE to remove those messages from the buffer.

Copied & pasted parts from one of my releases, copied in the browser so no idea if it'll work out of the box like that(might need some edits)

@ainkut
That's cool, thanks. So it's essentially, literally a window from a DLL on thread. I'll look at that some more.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us