#include extern "C" __cdecl void ref() { HMODULE hModule; LPSTR cmdLine; LPSTR dllPath; LPSTR token; int argCount = 0; // Get the command line cmdLine = GetCommandLineA(); if (cmdLine == NULL) { MessageBoxA(NULL, "Failed to get command line", "Error", MB_OK | MB_ICONERROR); goto fail; } // Skip the executable name (first token) token = cmdLine; while (*token != '\0' && *token != ' ') { if (*token == '"') { token++; while (*token != '\0' && *token != '"') token++; if (*token == '"') token++; } else { token++; } } // Skip spaces while (*token == ' ') token++; // Check if DLL path argument exists if (*token == '\0') { MessageBoxA(NULL, "Usage: ", "Error", MB_OK | MB_ICONERROR); goto fail; } // Extract DLL path (handle quoted paths) dllPath = token; if (*dllPath == '"') { dllPath++; while (*token != '\0' && *token != '"') token++; *token = '\0'; } else { while (*token != '\0' && *token != ' ') token++; *token = '\0'; } // Load the DLL hModule = LoadLibraryA(dllPath); if (hModule == NULL) { MessageBoxA(NULL, "Failed to load DLL", "Error", MB_OK | MB_ICONERROR); goto fail; } // Successfully loaded DLL MessageBoxA(NULL, "DLL loaded successfully", "Success", MB_OK | MB_ICONINFORMATION); // Free the library FreeLibrary(hModule); return; fail: ExitProcess(1); }