Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 05:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



The Code which isn't working onyl windows xp

Discussion on The Code which isn't working onyl windows xp within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 19
Received Thanks: 0
Unhappy The Code which isn't working onyl windows xp

Hi to all !

I have made a code which can enumerate module names associated threads.
But there is a problem in windows xp. When i enumarate modules dll names return NULL.

IN WINDOWS XP LIKE THAT :
Code:
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls : 
Karacabay-Scan : Dlls :
IN WINDOWS 8 , WINDOWS 7 , WIN 8.1
Code:
Karacabay-Scan : Dlls : D:\TEMIZ METIN2 - HS CALISMA\giris.exe
Karacabay-Scan : Dlls : D:\TEMIZ METIN2 - HS CALISMA\giris.exe
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\SYSTEM32\ntdll.dll
Karacabay-Scan : Dlls : C:\Windows\system32\mswsock.dll
And here is my source :
Code:
#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#define ThreadQuerySetWin32StartAddress 9
typedef NTSTATUS (WINAPI *NTQUERYINFOMATIONTHREAD)(HANDLE, LONG, PVOID, ULONG, PULONG);

BOOL MatchAddressToModule(__in DWORD dwProcId, __out_bcount(MAX_PATH) LPTSTR lpstrModule, __in DWORD dwThreadStartAddr, __out_opt PDWORD pModuleStartAddr) // by Echo
{
    BOOL bRet = FALSE;
	HANDLE hSnapshot;
	MODULEENTRY32 moduleEntry32;

	hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPALL, dwProcId);

	moduleEntry32.dwSize = sizeof(MODULEENTRY32);
	moduleEntry32.th32ModuleID = 1;

	if(Module32First(hSnapshot, &moduleEntry32)){
	    if(dwThreadStartAddr >= (DWORD)moduleEntry32.modBaseAddr && dwThreadStartAddr <= ((DWORD)moduleEntry32.modBaseAddr + moduleEntry32.modBaseSize)){
           
			 wcscpy(lpstrModule, moduleEntry32.szExePath);
    //convert from wide char to narrow char array
   
			
	    }else{
            while(Module32Next(hSnapshot, &moduleEntry32)){
                if(dwThreadStartAddr >= (DWORD)moduleEntry32.modBaseAddr && dwThreadStartAddr <= ((DWORD)moduleEntry32.modBaseAddr + moduleEntry32.modBaseSize)){
                   wcscpy(lpstrModule, moduleEntry32.szExePath);
					

                    break;
                }
            }
	    }
    }

    if(pModuleStartAddr) *pModuleStartAddr = (DWORD)moduleEntry32.modBaseAddr;
	CloseHandle(hSnapshot);

	return bRet;
}

DWORD WINAPI GetThreadStartAddress(__in HANDLE hThread) // by Echo
{
    NTSTATUS ntStatus;
    DWORD dwThreadStartAddr = 0;
    HANDLE hPeusdoCurrentProcess, hNewThreadHandle;
    NTQUERYINFOMATIONTHREAD NtQueryInformationThread;

    if((NtQueryInformationThread = (NTQUERYINFOMATIONTHREAD)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), ("NtQueryInformationThread")))){
        hPeusdoCurrentProcess = GetCurrentProcess();
        if(DuplicateHandle(hPeusdoCurrentProcess, hThread, hPeusdoCurrentProcess, &hNewThreadHandle, THREAD_QUERY_INFORMATION, FALSE, 0)){
            ntStatus = NtQueryInformationThread(hNewThreadHandle, ThreadQuerySetWin32StartAddress, &dwThreadStartAddr, sizeof(DWORD), NULL);
            CloseHandle(hNewThreadHandle);
            if(ntStatus != STATUS_SUCCESS){
				return 0;
			}
        }

    }

    return dwThreadStartAddr;
}

int threadmodules()
{
 HANDLE hSnapshot, hThread;
    THREADENTRY32 threadEntry32;
    DWORD dwModuleBaseAddr, dwThreadStartAddr;
    TCHAR lpstrModuleName[MAX_PATH] = {0};
	CHAR moduleget[MAX_PATH] = {0};
    if((hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, GetCurrentProcessId())) == INVALID_HANDLE_VALUE) return 0;

    threadEntry32.dwSize = sizeof(THREADENTRY32);
    threadEntry32.cntUsage = 0;

    if(Thread32First(hSnapshot, &threadEntry32)){
        if(threadEntry32.th32OwnerProcessID == GetCurrentProcessId()){
			hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, threadEntry32.th32ThreadID);
			dwThreadStartAddr = GetThreadStartAddress(hThread);
			MatchAddressToModule(GetCurrentProcessId(), lpstrModuleName, dwThreadStartAddr, &dwModuleBaseAddr);
				std::wstring aaa  (lpstrModuleName);
				std::string mystr (aaa.begin() , aaa.end());

				fstream textfile;
					textfile.open ("mgm.log", ios::out | ios::app);
					textfile<< "Karacabay-Scan : " <<"Dlls : "<< mystr.c_str()<< endl;

				CloseHandle(hThread);
		}
		while(Thread32Next(hSnapshot, &threadEntry32)){
			if(threadEntry32.th32OwnerProcessID == GetCurrentProcessId()){
				hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, threadEntry32.th32ThreadID);
				dwThreadStartAddr = GetThreadStartAddress(hThread);
				MatchAddressToModule(GetCurrentProcessId(), lpstrModuleName, dwThreadStartAddr, &dwModuleBaseAddr);
				std::wstring aaa  (lpstrModuleName);
				std::string mystr (aaa.begin() , aaa.end());

				fstream textfile;
					textfile.open ("mgm.log", ios::out | ios::app);
					textfile<< "Karacabay-Scan : " <<"Dlls : "<< mystr.c_str()<< endl;

				CloseHandle(hThread);
			}
        }
    }

	CloseHandle(hSnapshot);
	return 0;
}
oguzhane is offline  
Old 08/06/2014, 19:51   #2
 
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
That's not your code. . Learn the language and make your own version and then maybe ask a real question not something like "Why does it not work please fix so i can c&p some more". You just made it write to a file instead of the console.
th0rex is offline  
Thanks
2 Users
Old 08/06/2014, 19:57   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 19
Received Thanks: 0
Quote:
Originally Posted by omitma View Post
That's not your code. . Learn the language and make your own version and then maybe ask a real question not something like "Why does it not work please fix so i can c&p some more". You just made it write to a file instead of the console.
if you don't want to help just **** off i want help only not discussions about my subject.
oguzhane is offline  
Reply


Similar Threads Similar Threads
my server working on windows so windows sf and i get success players join with bind_i
07/18/2014 - Metin2 Private Server - 0 Replies
my server working on windows so windows sf and get i get succes players can be join anymore with bind_ip but now i cant join my server with 192.168.x.x or with my public ip and i found it http://www.elitepvpers.com/forum/metin2-pserver-gu ides-strategies/3043824-sammelthread-game-source-c hanges.html for external ip but i cant add to config.cpp so because of my bad there is must be fix need help
PHO_Naked Chams v1 Windows7,Windows XP,Windows Vista working Free Download!!!
01/07/2013 - Soldier Front Hacks, Bots, Cheats & Exploits - 5 Replies
Windows 7 32-bit = working 64-bit = working Windows XP = Not Working Windows Vista = Not Working Features Auto On= Naked
Imperial Online-BacktoEcsro [90 Cap Onyl China][NEW server]Vsro
07/12/2012 - SRO PServer Advertising - 46 Replies
Server Name: İmperial online (BackToEcsro) Server Files: Vsro Version: 1.94 Level Cap: 90 Mastery Cap: 300 Slots=1000 Homepage:Imperial Online | Ana Sayfa Fanpage: Imperial Online | Facebook Status: Online
Any working uce for windows 7 out there
12/25/2009 - S4 League - 0 Replies
Hi I have been trying to get a couple of uce's to work with S4. Yes I have cracked client and bypass,it seems I cant attach to the process for some reason with kiki uce or any of the others any solution? I would appreciate some feed back thank you ^_^



All times are GMT +2. The time now is 05:15.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.