I have been trying to make a universal DLL to where I can inject it into a process & a window would pop up. I have all required functions such as WinMain (I named mine Initiate and called it manually), DllWindowProcedure, and DllMain. However, after compilation, there is one warning and no errors - I believe it is a logical error. If you spot any issues, or anything I can improve, please let me know!
Warning:
1>Main.cpp(43): warning C4060: switch statement contains no 'case' or 'default' labels
Code:
#include <Windows.h>
HINSTANCE InjectedModuleHandle;
LRESULT CALLBACK DllWindowProcedure(HWND, UINT, WPARAM, LPARAM);
DWORD WINAPI DllThreadProcedure(void * Data)
{
MessageBoxA(NULL, (LPCSTR)"Welcome to Flames v1.1!", (LPCSTR)"Startup Message", NULL);
MSG Messages;
WNDCLASSEX WindowClass;
WindowClass.hInstance = InjectedModuleHandle;
WindowClass.lpszClassName = L"DllWindowClass";
WindowClass.lpfnWndProc = DllWindowProcedure;
WindowClass.style = CS_DBLCLKS;
WindowClass.cbSize = sizeof(WNDCLASSEX);
WindowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WindowClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WindowClass.lpszMenuName = NULL;
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
WindowClass.hbrBackground = (HBRUSH)RGB(255, 255, 255);
RegisterClassEx(&WindowClass);
HWND Window = CreateWindowEx(0, L"DllWindowClass", L"Flames v1.1 - By XenoSaga3000", (WS_SYSMENU | WS_MINIMIZEBOX), 200, 200, 500, 450, FindWindow(NULL, L"ROBLOX"), CreateMenu(), InjectedModuleHandle, NULL);
ShowWindow(Window, SW_SHOWNORMAL);
while (GetMessage(&Messages, NULL, 0, 0))
{
TranslateMessage(&Messages);
DispatchMessage(&Messages);
};
return 1;
};
LRESULT CALLBACK DllWindowProcedure(HWND Window, UINT Message, WPARAM WParameter, LPARAM LParameter)
{
switch (Message)
{
case WM_COMMAND:
switch(WParameter)
{
//Check for commands here.
};
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(Window, Message, WParameter, LParameter);
};
return 0;
};
bool APIENTRY DllMain(HMODULE DllInstance, DWORD Reason, LPVOID Reserved)
{
if(Reason == DLL_PROCESS_ATTACH)
{
InjectedModuleHandle = DllInstance;
CreateThread(0, NULL, DllThreadProcedure, NULL, NULL, NULL);
};
return TRUE;
};