Add files via upload

This commit is contained in:
jazir5 2025-04-03 20:45:39 -07:00 committed by GitHub
parent 6a61614fda
commit 500dc18195
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 226 additions and 121 deletions

BIN
exe/BlackOverlay.exe Normal file

Binary file not shown.

105
exe/buildexe.bat Normal file
View File

@ -0,0 +1,105 @@
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include <windows.h>
#include <shellapi.h> // Needed for CommandLineToArgvW
// --- Configuration ---
const wchar_t WINDOW_TITLE[] = L"---BlackOverlayScreen---";
const wchar_t CLASS_NAME[] = L"BlackOverlayClass";
// --- End Configuration ---
// Forward declaration for wWinMain if WinMain calls it
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow);
// ADDED ANSI WinMain entry point wrapper
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
// Get command line arguments as Unicode
int argc;
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if (argv == NULL) {
// Handle error if needed, perhaps return a failure code
return -1;
}
// Call the Unicode wWinMain function
// Note: We don't directly use lpCmdLine here, relying on GetCommandLineW instead.
// We also pass the original hInstance and nCmdShow. hPrevInstance is obsolete.
int result = wWinMain(hInstance, hPrevInstance, NULL, nCmdShow); // Pass NULL for pwCmdLine as wWinMain doesn't use it
// Free the memory allocated by CommandLineToArgvW
LocalFree(argv);
return result;
}
// Window Procedure (remains the same)
LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
FillRect(hdc, &ps.rcPaint, (HBRUSH)GetStockObject(BLACK_BRUSH));
EndPaint(hwnd, &ps);
}
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
// Existing UNICODE wWinMain entry point (remains mostly the same)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) {
// NOTE: We ignore hPrevInstance and pCmdLine parameters as they are handled/obsolete
// 1. Register the window class.
WNDCLASS wc = { };
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
if (!RegisterClass(&wc)) {
return -1;
}
// 2. Get screen dimensions for maximization
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
// 3. Create the window.
HWND hwnd = CreateWindowEx(
WS_EX_TOPMOST,
CLASS_NAME,
WINDOW_TITLE,
WS_POPUP | WS_VISIBLE,
0, 0, screenWidth, screenHeight,
NULL, NULL, hInstance, NULL
);
if (hwnd == NULL) {
return -1;
}
// 4. Run the message loop.
MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}

View File

@ -1,121 +1,121 @@
@echo off
SETLOCAL EnableDelayedExpansion
:: ==========================================================================
:: Script to Install C++ Build Dependencies (MinGW-w64 via Chocolatey)
:: Requires Administrator privileges and Internet connection.
:: Handles potential non-fatal warnings from choco install for mingw.
:: ==========================================================================
:: Check for Admin privileges
echo Checking for administrative privileges...
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo ERROR: This script requires administrative privileges.
echo Please right-click and select "Run as administrator".
pause
goto :EOF
) else (
echo Running with administrative privileges.
)
echo.
:: Define Variables
SET "CHOCO_INSTALL_CMD=Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
SET "MINGW_PACKAGE=mingw"
SET "INSTALL_ATTEMPTED=0"
:: --- Step 1: Check/Install Chocolatey ---
echo Checking for Chocolatey installation...
choco -? >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Chocolatey not found. Attempting to install...
echo This requires PowerShell and an internet connection.
powershell -NoProfile -ExecutionPolicy Bypass -Command "%CHOCO_INSTALL_CMD%"
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: Chocolatey installation failed. Please check your internet connection
echo and PowerShell execution policy settings. Manual installation may be required.
echo Visit https://chocolatey.org/install for instructions.
pause
goto :EOF
) ELSE (
echo Chocolatey installation appears successful.
echo NOTE: You might need to open a NEW command prompt for choco to be fully available in PATH.
echo Running 'refreshenv' command now to attempt immediate PATH refresh...
refreshenv
REM Small delay to allow environment refresh
timeout /t 3 /nobreak >nul
)
) ELSE (
echo Chocolatey is already installed.
)
echo.
:: Verify Choco again after potential install/refresh
choco -? >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: Chocolatey command is still not available after installation attempt.
echo Please open a new Administrator command prompt and try running this script again,
echo or install MinGW manually.
pause
goto :EOF
)
:: --- Step 2: Check/Install MinGW-w64 ---
echo Checking if '%MINGW_PACKAGE%' package is installed via Chocolatey...
choco list --local-only --exact "%MINGW_PACKAGE%" | findstr /B /C:"%MINGW_PACKAGE%" >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo '%MINGW_PACKAGE%' package not found or check failed. Attempting to install/ensure...
SET "INSTALL_ATTEMPTED=1"
choco install %MINGW_PACKAGE% --yes --force --no-progress
IF %ERRORLEVEL% NEQ 0 (
echo WARNING: 'choco install %MINGW_PACKAGE%' finished with a non-zero exit code.
echo This might be due to non-fatal warnings (like missing old paths).
echo Continuing to verification step, but check output above carefully.
REM Do not exit here, let the g++ check be the final arbiter
) ELSE (
echo 'choco install %MINGW_PACKAGE%' command completed successfully (Exit Code 0).
)
echo Running 'refreshenv' command to attempt PATH update...
refreshenv
REM Small delay to allow environment refresh
timeout /t 3 /nobreak >nul
) ELSE (
echo '%MINGW_PACKAGE%' package appears to be already installed.
)
echo.
:: --- Step 3: Verify g++ availability ---
echo Verifying g++ command availability...
where g++ >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: 'g++' command was not found in the current PATH even after installation attempt/check.
IF "!INSTALL_ATTEMPTED!"=="1" (
echo Possible causes:
echo - The 'mingw' package installation truly failed despite reporting success internally. Check logs.
echo - The PATH environment variable hasn't updated in this session yet.
) ELSE (
echo Possible cause: The PATH environment variable hasn't updated in this session yet.
)
echo.
echo IMPORTANT: Please CLOSE this window and open a NEW Administrator
echo command prompt. Then try running the build script.
pause
goto :EOF
) ELSE (
echo Verification successful: 'g++' command found in PATH:
where g++
echo.
echo ==========================================================================
echo Build Dependency Installation/Verification Complete!
echo ==========================================================================
echo MinGW-w64 (containing g++) should be ready.
IF "!INSTALL_ATTEMPTED!"=="1" (
echo NOTE: If the build script still fails, ensure you run it from a NEW command prompt.
)
echo.
)
pause
ENDLOCAL
goto :EOF
@echo off
SETLOCAL EnableDelayedExpansion
:: ==========================================================================
:: Script to Install C++ Build Dependencies (MinGW-w64 via Chocolatey)
:: Requires Administrator privileges and Internet connection.
:: Handles potential non-fatal warnings from choco install for mingw.
:: ==========================================================================
:: Check for Admin privileges
echo Checking for administrative privileges...
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo ERROR: This script requires administrative privileges.
echo Please right-click and select "Run as administrator".
pause
goto :EOF
) else (
echo Running with administrative privileges.
)
echo.
:: Define Variables
SET "CHOCO_INSTALL_CMD=Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
SET "MINGW_PACKAGE=mingw"
SET "INSTALL_ATTEMPTED=0"
:: --- Step 1: Check/Install Chocolatey ---
echo Checking for Chocolatey installation...
choco -? >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Chocolatey not found. Attempting to install...
echo This requires PowerShell and an internet connection.
powershell -NoProfile -ExecutionPolicy Bypass -Command "%CHOCO_INSTALL_CMD%"
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: Chocolatey installation failed. Please check your internet connection
echo and PowerShell execution policy settings. Manual installation may be required.
echo Visit https://chocolatey.org/install for instructions.
pause
goto :EOF
) ELSE (
echo Chocolatey installation appears successful.
echo NOTE: You might need to open a NEW command prompt for choco to be fully available in PATH.
echo Running 'refreshenv' command now to attempt immediate PATH refresh...
refreshenv
REM Small delay to allow environment refresh
timeout /t 3 /nobreak >nul
)
) ELSE (
echo Chocolatey is already installed.
)
echo.
:: Verify Choco again after potential install/refresh
choco -? >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: Chocolatey command is still not available after installation attempt.
echo Please open a new Administrator command prompt and try running this script again,
echo or install MinGW manually.
pause
goto :EOF
)
:: --- Step 2: Check/Install MinGW-w64 ---
echo Checking if '%MINGW_PACKAGE%' package is installed via Chocolatey...
choco list --local-only --exact "%MINGW_PACKAGE%" | findstr /B /C:"%MINGW_PACKAGE%" >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo '%MINGW_PACKAGE%' package not found or check failed. Attempting to install/ensure...
SET "INSTALL_ATTEMPTED=1"
choco install %MINGW_PACKAGE% --yes --force --no-progress
IF %ERRORLEVEL% NEQ 0 (
echo WARNING: 'choco install %MINGW_PACKAGE%' finished with a non-zero exit code.
echo This might be due to non-fatal warnings (like missing old paths).
echo Continuing to verification step, but check output above carefully.
REM Do not exit here, let the g++ check be the final arbiter
) ELSE (
echo 'choco install %MINGW_PACKAGE%' command completed successfully (Exit Code 0).
)
echo Running 'refreshenv' command to attempt PATH update...
refreshenv
REM Small delay to allow environment refresh
timeout /t 3 /nobreak >nul
) ELSE (
echo '%MINGW_PACKAGE%' package appears to be already installed.
)
echo.
:: --- Step 3: Verify g++ availability ---
echo Verifying g++ command availability...
where g++ >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo ERROR: 'g++' command was not found in the current PATH even after installation attempt/check.
IF "!INSTALL_ATTEMPTED!"=="1" (
echo Possible causes:
echo - The 'mingw' package installation truly failed despite reporting success internally. Check logs.
echo - The PATH environment variable hasn't updated in this session yet.
) ELSE (
echo Possible cause: The PATH environment variable hasn't updated in this session yet.
)
echo.
echo IMPORTANT: Please CLOSE this window and open a NEW Administrator
echo command prompt. Then try running the build script.
pause
goto :EOF
) ELSE (
echo Verification successful: 'g++' command found in PATH:
where g++
echo.
echo ==========================================================================
echo Build Dependency Installation/Verification Complete!
echo ==========================================================================
echo MinGW-w64 (containing g++) should be ready.
IF "!INSTALL_ATTEMPTED!"=="1" (
echo NOTE: If the build script still fails, ensure you run it from a NEW command prompt.
)
echo.
)
pause
ENDLOCAL
goto :EOF