Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    remka
    remka is offline
    Member-in-training remka's Avatar
    Join Date
    2010 Oct
    Location
    Moscow
    Posts
    161
    Thanks
    17
    Thanked 31 Times in 6 Posts
    Rep Power
    8
    you crazy...
    Please write to the PM only at the right issues.
    or if you know what 0x90)))
    P.s.
    it's NOT NOP

  2. #12
    codeprada
    codeprada is offline
    New member codeprada's Avatar
    Join Date
    2010 Dec
    Posts
    7
    Thanks
    1
    Thanked 1 Time in 1 Post
    Rep Power
    0
    using the EnumWindows method i posted before i realized that it created an endless loop until FALSE is returned which could be a problem. after alot of reading and trial and error i came up with a way to get the window handle of the process you've injected your DLL into.

    Code:
    #define T TEXT
    
    LONG oWndProc;
    DWORD threadID;
    HWND hijHwnd;
    
    BOOL CALLBACK WinEnum(HWND hwnd, LPARAM lParam)
    {
    	if (hwnd == NULL) 
    		MessageBox(HWND_DESKTOP, T("Error getting window"),T("Error"), MB_OK);
    	else 
    	{
    		DWORD processId;
    		GetWindowThreadProcessId(hwnd, &processId);
    		if (processId == GetCurrentProcessId()) {
    			hijHwnd = hwnd;
    			return FALSE;
    		}
    		
    	}
    
    	return TRUE;
    }
    
    DWORD WINAPI thread(LPVOID)
    {
    
    	HWND hwnd;
    	EnumWindows(WinEnum, NULL);
    	if (hijHwnd != NULL) {
    		hwnd = hijHwnd;
                    //just printing the window name just for an example
    		char *wName = (char *)malloc(sizeof(char) * MAX_PATH);
    		GetWindowText(hwnd, LPWSTR(wName), MAX_PATH); 
    		MessageBox(NULL, LPCWSTR(wName), TEXT("Window Name"), MB_OK | MB_ICONINFORMATION);
    		free(wName);
    		
    		oWndProc = SetWindowLong(hwnd, GWL_WNDPROC, (long)nWndProc); 
    		
    	}
    	return TRUE;
    
    }
    
    BOOL APIENTRY DllMain( HMODULE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
    					 )
    {
    	switch (ul_reason_for_call)
    	{
    	case DLL_PROCESS_ATTACH:
    		{
    			CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&thread, 0, 0, &threadID);			
    		}
    		break;
    	case DLL_THREAD_ATTACH:
    		{
    			
    		}
    		break;
    	case DLL_THREAD_DETACH:
    	case DLL_PROCESS_DETACH:
    		break;
    	}
    	return TRUE;
    }
    You could never break my stride, you never slowed the momentum at any moment I'm bout to blow, you'll never take my pride

  3. #13
    remka
    remka is offline
    Member-in-training remka's Avatar
    Join Date
    2010 Oct
    Location
    Moscow
    Posts
    161
    Thanks
    17
    Thanked 31 Times in 6 Posts
    Rep Power
    8
    #define T TEXT -> you can use L example: std::wstring wstr=L"sample widechar text";
    Please write to the PM only at the right issues.
    or if you know what 0x90)))
    P.s.
    it's NOT NOP

  4. #14
    codeprada
    codeprada is offline
    New member codeprada's Avatar
    Join Date
    2010 Dec
    Posts
    7
    Thanks
    1
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by remka View Post
    #define T TEXT -> you can use L example: std::wstring wstr=L"sample widechar text";
    i used TEXT because L doesn't work with Bloodshed Dev compiler. L seems to be a microsoft thing
    You could never break my stride, you never slowed the momentum at any moment I'm bout to blow, you'll never take my pride

Page 2 of 2 FirstFirst 12
Visitors found this page by searching for:

_tcscmp: identifier not found

error c2065: gwl_wndproc : undeclared identifier

cannot convert parameter 1 from const wchar_t * to TCHAR *

gwl_wndproc undeclared identifier

error C3861: GetModuleBaseName: identifier not found

GetModuleBaseName: identifier not found

c get hwnd from process

cannot convert from const wchar_t * to TCHAR

c get hwnd from process id

how to get handle of current window in c

getmodulebasename identifier not found

get hwnd from process c

c get window handle from process id

GWL_WNDPROC : undeclared identifier

const wchar_t * to TCHAR *

How to get the window handle from a thread C

get hprocess from window handle

get hwnd from process id c

get window handle from process id c

c# how to get a window handle

find window handle in c

winenum

get window handle c

get process window handle

get hwnd from process id vc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •