예제 #1
0
int APIENTRY _tWinMain(
    _In_ HINSTANCE      hInstance,
    _In_opt_ HINSTANCE  hPrevInstance,
    _In_ LPTSTR         lpCmdLine,
    _In_ int            nCmdShow
    )
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // Initialize global strings
    MyRegisterClass(hInstance);

    // Perform application initialization:
    if (!InitInstance (hInstance, nCmdShow))
    {
        return FALSE;
    }

    initD3D(hWnd);

    // Main message loop:
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    cleanD3D();

    return (int) msg.wParam;
}
예제 #2
0
파일: d2.cpp 프로젝트: anokata/AllInOne
// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
    HWND hWnd;
    WNDCLASSEX wc;

    ZeroMemory(&wc, sizeof(WNDCLASSEX));

    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.lpszClassName = "WindowClass";

    RegisterClassEx(&wc);

    hWnd = CreateWindowEx(0,
                          "WindowClass",
                          "Our Direct3D Program",
                          WS_OVERLAPPEDWINDOW,
                          0, 0,
                          SCREEN_WIDTH, SCREEN_HEIGHT,
                          NULL,
                          NULL,
                          hInstance,
                          NULL);

    ShowWindow(hWnd, nCmdShow);

    // set up and initialize Direct3D
    initD3D(hWnd);

    // enter the main loop:

    MSG msg;

    while(TRUE)
    {
        while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }

        if(msg.message == WM_QUIT)
            break;

        render_frame();
    }

    // clean up DirectX and COM
    cleanD3D();

    return msg.wParam;
}
예제 #3
0
파일: main.cpp 프로젝트: Xekep/Legacy-Code
//28.
// the entry point for any Windows program
//29.
int WINAPI WinMain(HINSTANCE hInstance,
                   //30.
                   HINSTANCE hPrevInstance,
                   //31.
                   LPSTR lpCmdLine,
                   //32.
                   int nCmdShow)
//33.
{
    //34.
    HWND hWnd;
    //35.
    WNDCLASSEX wc;
    //36.

    //37.
    ZeroMemory(&wc, sizeof(WNDCLASSEX));
    //38.

    //39.
    wc.cbSize = sizeof(WNDCLASSEX);
    //40.
    wc.style = CS_HREDRAW | CS_VREDRAW;
    //41.
    wc.lpfnWndProc = WindowProc;
    //42.
    wc.hInstance = hInstance;
    //43.
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    //44.
    // wc.hbrBackground = (HBRUSH)COLOR_WINDOW; // not needed any more
    //45.
    wc.lpszClassName = "WindowClass";
    //46.

    //47.
    RegisterClassEx(&wc);
    //48.

    //49.
    hWnd = CreateWindowEx(NULL,
                          //50.
                          "WindowClass",
                          //51.
                          "Our Direct3D Program",
                          //52.
                          WS_EX_TOPMOST | WS_POPUP, // fullscreen values
                          //53.
                          0, 0, // the starting x and y positions should be 0
                          //54.
                          SCREEN_WIDTH, SCREEN_HEIGHT, // set the window to 640 x 480
                          //55.
                          NULL,
                          //56.
                          NULL,
                          //57.
                          hInstance,
                          //58.
                          NULL);
    //59.

    //60.
    ShowWindow(hWnd, nCmdShow);
    //61.

    //62.
    // set up and initialize Direct3D
    //63.
    initD3D(hWnd);
    //64.

    //65.
    // enter the main loop:
    //66.

    //67.
    MSG msg;
    //68.

    //69.
    while(TRUE)
        //70.
    {
        //71.
        while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
            //72.
        {
            //73.
            TranslateMessage(&msg);
            //74.
            DispatchMessage(&msg);
            //75.
        }
        //76.

        //77.
        if(msg.message == WM_QUIT)
            //78.
            break;
        //79.

        //80.
        render_frame();
        //81.

        //82.
        // check the 'escape' key
        //83.
        if(KEY_DOWN(VK_ESCAPE))
            //84.
            PostMessage(hWnd, WM_DESTROY, 0, 0);
        //85.
    }
    //86.

    //87.
    // clean up DirectX and COM
    //88.
    cleanD3D();
    //89.

    //90.
    return msg.wParam;
    //91.
}
예제 #4
0
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
	HWND hWnd;
	WNDCLASSEX wc;

	ZeroMemory(&wc, sizeof(WNDCLASSEX));

	wc.cbSize = sizeof(WNDCLASSEX);
	wc.style = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc = WndProc;
	wc.hInstance = hInstance;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)RGB(0, 0, 0);
	wc.lpszClassName = "WindowClass";

	RegisterClassEx(&wc);	

		hWnd = CreateWindowEx(NULL,
			"WindowClass",
			"DirectX Test",
			WS_EX_TOPMOST | WS_POPUP,
			0, 0,
			SCREEN_WIDTH, SCREEN_HEIGHT,
			NULL,
			NULL,
			hInstance,
			NULL);


	SetWindowLong(hWnd, GWL_EXSTYLE, (int)GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED | WS_EX_TRANSPARENT);
	//SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 0, ULW_COLORKEY);
	SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 255, LWA_ALPHA);

	ShowWindow(hWnd, nCmdShow);

	// set up and initialize Direct3D
	initD3D(hWnd);	

	DWORD   dwThreadIdArray[MAX_THREADS];
	HANDLE  hThreadArray[MAX_THREADS];
	
	for (int i = 0; i < MAX_THREADS; i++)
	{
		hThreadArray[i] = CreateThread(
			NULL,
			0,
			(LPTHREAD_START_ROUTINE)mainThread,
			NULL,
			0,
			&dwThreadIdArray[i]);
	}
	
	m_Rect.left = 0;
	m_Rect.top = 0;
	m_Rect.right = SCREEN_WIDTH;
	m_Rect.bottom = SCREEN_HEIGHT;

	D3DXCreateFont(d3ddev, 10, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &pFont);
	// enter the main loop:
	MSG msg;
	::SetWindowPos(FindWindow(NULL, LGameWindow), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
	while (TRUE)
	{		
		Sleep(10);		
		::SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);		
		
		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

		if (msg.message == WM_QUIT)
			break;

		HWND hGameWindow = NULL;
		HANDLE hProcHandle = NULL;
		float vPunchX = NULL;
		float vPunchY = NULL;
		float vPunchZ = NULL;

		if (GetAsyncKeyState(VK_OEM_PLUS))
		{
			RectSize += 0.1f;
		}

		if (GetAsyncKeyState(VK_OEM_MINUS))
		{
			if (RectSize > 1)
			{
				RectSize -= 0.1f;
			}
		}

		if (GetAsyncKeyState(VK_NUMPAD7))
		{
			aimbotSize += 1;
		}
		if (GetAsyncKeyState(VK_NUMPAD8))
		{
			aimbotSize -= 1;
		}

		if (GetAsyncKeyState(VK_NUMPAD5))
		{
			readBone += 1;
			Sleep(200);
		}
		if (GetAsyncKeyState(VK_NUMPAD6) && readBone != 0)
		{
			readBone -= 1;
			Sleep(200);
		}

		hGameWindow = FindWindow(NULL, LGameWindow);
		if (hGameWindow)
		{
			GetWindowThreadProcessId(hGameWindow, &dwProcID);
			if (dwProcID != 0)
			{
				hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, false, dwProcID);
				if (hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
				{
					IsGameAvail = false;
				}
				else
				{
					IsGameAvail = true;
				}
			}
		}

		if (IsGameAvail)
		{
			GetWindowRect(FindWindow(NULL, LGameWindow), &m_Rect);

			if (GetAsyncKeyState(VK_NUMPAD9))
			{
				toggle = false;
				radar = false;
				trigger = false;
				norecoil = false;
			}

			if (GetAsyncKeyState(VK_NUMPAD1))
			{
				toggle = true;
			}

			if (GetAsyncKeyState(VK_NUMPAD2))
			{
				radar = true;
			}

			if (GetAsyncKeyState(VK_NUMPAD3))
			{
				trigger = true;
			}

			if (GetAsyncKeyState(VK_NUMPAD4))
			{
				norecoil = true;
			}

			if (toggle)
			{

				DWORD ClientBase = Module("client.dll");
				DWORD temp1 = ClientBase + LocalPlayer;
				ReadProcessMemory(hProcHandle, (LPCVOID)temp1, &dwLocalPlayer, 4, NULL);

				/* Reads the value of InCross */
				DWORD inCross = dwLocalPlayer + InCrosshair;
				DWORD ReadInCross = inCross;

				DWORD Lpitch = dwLocalPlayer + viewOffsetX;
				DWORD Lyaw = dwLocalPlayer + viewOffsetY;

				ReadProcessMemory(hProcHandle, (LPCVOID)Lpitch, &localPlayerStruct.pitch, sizeof(localPlayerStruct.viewAng), 0);
				ReadProcessMemory(hProcHandle, (LPCVOID)Lyaw, &localPlayerStruct.yaw, sizeof(localPlayerStruct.yaw), 0);

				ReadProcessMemory(hProcHandle, (LPCVOID)ReadInCross, &vInCross, sizeof(vInCross), 0);

				/* Read the value of LocalPlayer-TeamNum */
				DWORD LTeamNum = dwLocalPlayer + teamNumber;
				DWORD ReadLTeamNum = LTeamNum;
				
				ReadProcessMemory(hProcHandle, (LPCVOID)ReadLTeamNum, &vLTeamNum, sizeof(vLTeamNum), 0);

				DWORD LPosX = dwLocalPlayer + PositionX;
				DWORD LPosY = dwLocalPlayer + PositionY;
				DWORD LPosZ = dwLocalPlayer + PositionZ;

				ReadProcessMemory(hProcHandle, (LPCVOID)LPosX, &localPlayerStruct.Position[0], sizeof(localPlayerStruct.Position[0]), 0);
				ReadProcessMemory(hProcHandle, (LPCVOID)LPosY, &localPlayerStruct.Position[1], sizeof(localPlayerStruct.Position[1]), 0);
				ReadProcessMemory(hProcHandle, (LPCVOID)LPosZ, &localPlayerStruct.Position[2], sizeof(localPlayerStruct.Position[2]), 0);

				localPlayerStruct.teamNum = vLTeamNum;


				DWORD temp51 = ClientBase + ViewMatrix;
				ReadProcessMemory(hProcHandle, (LPCVOID)temp51, &localPlayerStruct.WorldToScreenMatrix, sizeof(localPlayerStruct.WorldToScreenMatrix), 0);

				TargetsInfo* targetsInfo = new TargetsInfo[64];

				DWORD temp100 = Module("client.dll") + 0x4A3554C + 0x50;
				DWORD temp101;

				ReadProcessMemory(hProcHandle, (LPCVOID)temp100, &temp101, sizeof(temp101), NULL);

				int targetLoop = 0;
				/* Read the Value of EnityList-TeamNum */
				for (int i = 0; i < 64; i++)
				{
					DWORD temp2 = ClientBase + EntityList + (i * EntitySize);
					ReadProcessMemory(hProcHandle, (LPCVOID)temp2, &playersInfo[i].playerAddress, sizeof(playersInfo[i].playerAddress), NULL);
					DWORD temp3 = playersInfo[i].playerAddress + teamNumber;
					ReadProcessMemory(hProcHandle, (LPCVOID)temp3, &playersInfo[i].teamNum, sizeof(playersInfo[i].teamNum), NULL);

					DWORD posX = playersInfo[i].playerAddress + PositionX;
					DWORD posY = playersInfo[i].playerAddress + PositionY;
					DWORD posZ = playersInfo[i].playerAddress + PositionZ;

					DWORD temp102 = temp101 + 0x1E0 * i;

					DWORD temp103 = temp102 + 0x24;

					ReadProcessMemory(hProcHandle, (LPCVOID)temp103, &playersInfo[i].Name, sizeof(playersInfo[i].Name), NULL);

					ReadProcessMemory(hProcHandle, (LPCVOID)posX, &playersInfo[i].Position[0], sizeof(playersInfo[i].Position[0]), NULL);
					ReadProcessMemory(hProcHandle, (LPCVOID)posY, &playersInfo[i].Position[1], sizeof(playersInfo[i].Position[1]), NULL);
					ReadProcessMemory(hProcHandle, (LPCVOID)posZ, &playersInfo[i].Position[2], sizeof(playersInfo[i].Position[2]), NULL);

					DWORD LifeState = playersInfo[i].playerAddress + LifeStatus;

					ReadProcessMemory(hProcHandle, (LPCVOID)LifeState, &playersInfo[i].lifeState, sizeof(playersInfo[i].lifeState), NULL);

					DWORD boneAddress = playersInfo[i].playerAddress + BoneMatrix;

					ReadProcessMemory(hProcHandle, (LPCVOID)boneAddress, &playersInfo[i].boneMatrixAddress, sizeof(playersInfo[i].boneMatrixAddress), NULL);

					GetBonePosition(readBone, i, hProcHandle);

					// Read the value of Health
					DWORD LHealth = playersInfo[i].playerAddress + HealthOff;
					DWORD ReadLHealth = LHealth;
					ReadProcessMemory(hProcHandle, (LPCVOID)ReadLHealth, &vLHealth, sizeof(vLHealth), 0);
					playersInfo[i].Health = vLHealth;

					playersInfo[i].distance = Get3dDistance(localPlayerStruct.Position, playersInfo[i].Position);

					float width = (ESPwidth / playersInfo[i].distance) * 0.5;
					float height = (ESPheight / playersInfo[i].distance) * 0.65;

					if (playersInfo[i].teamNum == localPlayerStruct.teamNum)
						continue;

					if (playersInfo[i].Health < 1)
						continue;

					if (playersInfo[i].lifeState == 0)
						continue;

					if (!WorldToScreen(playersInfo[i].boneXYZ, BoneXY))
						continue;

					if (BoneXY[0] < (SCREEN_WIDTH / 2) - aimbotSize || BoneXY[0] > (SCREEN_WIDTH / 2) + aimbotSize)
						continue;

					if (BoneXY[1] < (SCREEN_HEIGHT / 2) - aimbotSize || BoneXY[1] > (SCREEN_HEIGHT / 2) + aimbotSize)
						continue;

					targetsInfo[targetLoop] = TargetsInfo(localPlayerStruct.Position, playersInfo[i].Position, BoneXY);
					

					targetLoop++;

					
				}
				
				if (targetLoop > 0)
				{
					std::sort(targetsInfo, targetsInfo + targetLoop, CompareTargetEnArray());

					if (GetAsyncKeyState(0x45))
					{
						mouse_event(MOUSEEVENTF_ABSOLUTE, targetsInfo[0].AimXY[0] - (m_Rect.right / 2),
							targetsInfo[0].AimXY[1] - (m_Rect.bottom / 2), 0, 0);
					}
				}

				targetLoop = 0;

				delete [] targetsInfo;

				if (vInCross < 64 && vInCross > 0)
				{
					if (vLTeamNum != playersInfo[vInCross - 1].teamNum
						&& playersInfo[vInCross - 1].lifeState != 0
						&& !GetAsyncKeyState(0x01)
						&& trigger)
					{
						mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
						mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
					}
				}
				/*
				if (GetAsyncKeyState(0x01) && norecoil)
				{
					DWORD Lpitch = dwLocalPlayer + viewOffsetX;
					DWORD Lyaw = dwLocalPlayer + viewOffsetY;

					ReadProcessMemory(hProcHandle, (LPCVOID)Lpitch, &localPlayerStruct.pitch, sizeof(localPlayerStruct.viewAng), 0);
					ReadProcessMemory(hProcHandle, (LPCVOID)Lyaw, &localPlayerStruct.yaw, sizeof(localPlayerStruct.yaw), 0);

					DWORD anglePunchX = dwLocalPlayer + PunchX;
					DWORD anglePunchY = dwLocalPlayer + PunchY;

					float aPunchX;
					float aPunchY;

					ReadProcessMemory(hProcHandle, (LPCVOID)anglePunchX, &aPunchX, sizeof(aPunchX), NULL);
					ReadProcessMemory(hProcHandle, (LPCVOID)anglePunchY, &aPunchY, sizeof(aPunchY), NULL);

					DWORD temp40 = Module("engine.dll") + EPointer;
					DWORD temp41;
					
					ReadProcessMemory(hProcHandle, (LPCVOID)temp40, &temp41, sizeof(temp41), NULL);

					DWORD temp42 = temp41 + 0x4C90;
					DWORD temp43 = temp41 + 0x4C94;

					if (aPunchX < 0.001f && aPunchY < 0.001f)
						continue;

					localPlayerStruct.pitch -= aPunchX * 2.0f;
					localPlayerStruct.yaw -= aPunchY * 2.0f;
					WriteProcessMemory(hProcHandle, (LPVOID)temp42, &localPlayerStruct.pitch, sizeof(localPlayerStruct.pitch), NULL);
					WriteProcessMemory(hProcHandle, (LPVOID)temp43, &localPlayerStruct.yaw, sizeof(localPlayerStruct.yaw), NULL);
					
				}*/
			}
		}
	}

	// clean up DirectX and COM
	cleanD3D();
}
예제 #5
0
// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{
    // the handle for the window, filled by a function
    HWND hWnd;
    // this struct holds information for the window class
    WNDCLASSEX wc;

    // clear out the window class for use
    ZeroMemory(&wc, sizeof(WNDCLASSEX));

    // fill in the struct with the needed information
    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    wc.lpszClassName = L"WindowClass1";

    // register the window class
    RegisterClassEx(&wc);

    // create the window and use the result as the handle
    hWnd = CreateWindowEx(NULL,
                          L"WindowClass1",    // name of the window class
                          L"Our First Windowed Program",    // title of the window
                          WS_OVERLAPPEDWINDOW,    // window style
                          500,    // x-position of the window
                          200,    // y-position of the window
                          800,    // width of the window
                          600,    // height of the window
                          NULL,    // we have no parent window, NULL
                          NULL,    // we aren't using menus, NULL
                          hInstance,    // application handle
                          NULL);    // used with multiple windows, NULL

    // display the window on the screen
    ShowWindow(hWnd, nCmdShow);

    initD3D(hWnd);

    // enter the main loop:

    // this struct holds Windows event messages
    MSG msg;

    // Enter the infinite message loop
    while(TRUE)
    {
        // Check to see if any messages are waiting in the queue
        while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            // translate keystroke messages into the right format
            TranslateMessage(&msg);

            // send the message to the WindowProc function
            DispatchMessage(&msg);
        }

        // If the message is WM_QUIT, exit the while loop
        if(msg.message == WM_QUIT)
            break;

        render_frame();
    }

    cleanD3D();

    // return this part of the WM_QUIT message to Windows
    return msg.wParam;
}