Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-09-2020, 20:41
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
a good GUI framework for writing keygen: ImGui

For writing keygen, only limited types of widgets are needed, such as EditBox/Button/ComboBox/CheckBox etc.

Dear ImGui is a good GUI framework for writing keygen, with the concept of "Immediate Mode GUI", which is quite different from stateful GUI framework such as MFC/Qt etc. The generated EXE is less than 200KB with "Win32 + DirectX" binding and static CRT linking and /OPT:REF and /OPT:ICF. If you cut some source code manually, or use VC-LTL(https://github.com/Chuyu-Team/VC-LTL), EXE size can be decreased more.

It also has bindings for MacOS and Linux, which means you can also easily write small-size GUI keygen for MacOS and Linux, though different bindings require recompiling. If you want universal binding, SDL binding may be a choice, but the file size may increase.

github(we can play with its examples. The author of Dear ImGUI is quite active):
https://github.com/ocornut/imgui

some hints:

1. uncomment the following macros to cut gamepad support and directx xinput to decrease file size and remove xinput dll dependency.
Code:
#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
#define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT
2.disable "imgui.ini" saving/loading. or remove related code.
Code:
    ImGuiIO& io = ImGui::GetIO();
    io.IniFilename = NULL;
3. there are 3 built-in color styles, just choose one of them or add your own.
Code:
    //ImGui::StyleColorsDark();
    ImGui::StyleColorsClassic();
    //ImGui::StyleColorsLight();
4. load your own fonts.
Code:
    ImGuiIO& io = ImGui::GetIO();
    font = io.Fonts->AddFontFromFileTTF(u8"c:\\windows\\fonts\\cour.ttc", 16.0f * highDPIscaleFactor,...)
5. DPI scaling.

get DPI scaling factor "highDPIscaleFactor" for current desktop window, then multiply any height/width with this factor.
Code:
    ImGui_ImplWin32_EnableDpiAwareness();
    float highDPIscaleFactor = ImGui_ImplWin32_GetDpiScaleForHwnd(GetDesktopWindow());
set auto scaling when creating widgets without height/width specified:
Code:
    ImGuiStyle& style = ImGui::GetStyle();
    style.ScaleAllSizes(highDPIscaleFactor);
multiply the height/width of Win32 main window with highDPIscaleFactor:
Code:
HWND hwnd = ::CreateWindow(wc.lpszClassName, L"window demo title", WS_POPUPWINDOW, 0, 0, WINDOW_WIDTH * highDPIscaleFactor, WINDOW_HEIGHT * highDPIscaleFactor, NULL, NULL, wc.hInstance, NULL);
multiply the font size with highDPIscaleFactor:
Code:
    ImGuiIO& io = ImGui::GetIO();
    font = io.Fonts->AddFontFromFileTTF(u8"c:\\windows\\fonts\\cour.ttc", 16.0f * highDPIscaleFactor,...)
multiply the child window width with highDPIscaleFactor:
Code:
ImGui::BeginChild("Child", ImVec2(0, 90 * highDPIscaleFactor), true, window_flags);
I will not cover how to respond to DPI-changed message of Windows here, just add it by yourself if needed.

6. specify widget width with font size.

note: font size returned by ImGui::GetFontSize() is already DPI-scaled.
25.0 is the number of chars. If you use CJK font, the font width is double of English fonts, the width of 1 CJK char is that of 2 English chars.
Code:
ImGui::PushItemWidth((float)(int)(ImGui::GetFontSize() * 25.0f));
...
ImGui::PopItemWidth();
7. hide Win32 main window title bar, and drag window with window widget title bar(this part is for Win32 only)

A window widget is a kind of ImGui widgets whose type is "window".

hide win32 main window title:
just pass WS_POPUPWINDOW instead of WS_OVERLAPPEDWINDOW to CreateWindow.
Code:
HWND hwnd = ::CreateWindow(wc.lpszClassName, L"demo", WS_POPUPWINDOW, 0, 0, WINDOW_WIDTH * highDPIscaleFactor, WINDOW_HEIGHT * highDPIscaleFactor, NULL, NULL, wc.hInstance, NULL);
create a widget whose type is "window". A "close" button will apear in the title bar of this widget, but no minimize/maximize button supported yet. Fill all of its parent window(i.e. client area of Win32 main window) with this widget.
save the title bar height in a global variable for later use.
Code:
           static int titleBarHeight = 0;

            ImGui::SetNextWindowPos(ImVec2(0, 0));
            ImGui::SetNextWindowSize(ImGui::GetIO().DisplaySize);

            bool windowStatus = true;
            ImGui::Begin(u8"demo window widget title", &windowStatus, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings);

            if (!titleBarHeight)
                titleBarHeight = ImGui::GetFrameHeight();
if user clicks the "close" button of this window widget, call PostQuitMessage:
Code:
            if (!windowStatus)
                ::PostQuitMessage(0);
in WndProc() of Win32 main window, check whether user is dragging the title bar of this window widget and move the title-less Win32 window accordingly.
Code:
static bool dragWindow = false;

// Win32 message handler
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
        return true;

    static POINT startPos;

    switch (msg)
    {
    case WM_LBUTTONDOWN:
        startPos.x = (int)(short)LOWORD(lParam);
        startPos.y = (int)(short)HIWORD(lParam);
        if (titleBarHeight > 0 && startPos.y <= titleBarHeight)
        {
            dragWindow = true;
            SetCapture(hWnd);
        }
        break;
    case WM_LBUTTONUP:
        if (dragWindow)
        {
            dragWindow = false;
            ReleaseCapture();
        }
        break;
    case WM_MOUSEMOVE:
        if (dragWindow && (wParam & MK_LBUTTON))
        {
            RECT mainWindowRect;
            POINT pos;
            int windowWidth, windowHeight;

            pos.x = (int)(short)LOWORD(lParam);
            pos.y = (int)(short)HIWORD(lParam);

            GetWindowRect(hWnd, &mainWindowRect);
            windowHeight = mainWindowRect.bottom - mainWindowRect.top;
            windowWidth = mainWindowRect.right - mainWindowRect.left;

            ClientToScreen(hWnd, &pos);
            MoveWindow(hWnd, pos.x - startPos.x, pos.y - startPos.y, windowWidth, windowHeight, TRUE);
        }
        break;
8. add keyboard support for widgets, such Ctrl + C to copy text.
Code:
    ImGuiIO& io = ImGui::GetIO();
    io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
A keygen template source code repo deserves many words, but currently no time to do it yet. If anyone would like to help, it will be nice.
__________________
AKA Solomon/blowfish.

Last edited by WhoCares; 04-09-2020 at 20:52.
Reply With Quote
The Following 5 Users Say Thank You to WhoCares For This Useful Post:
chants (04-10-2020), Doit (06-04-2020), sh3dow (12-07-2022), SinaDiR (04-11-2020), Stingered (04-10-2020)
  #2  
Old 04-10-2020, 03:17
chants chants is online now
VIP
 
Join Date: Jul 2016
Posts: 725
Rept. Given: 35
Rept. Rcvd 48 Times in 30 Posts
Thanks Given: 666
Thanks Rcvd at 1,050 Times in 475 Posts
chants Reputation: 48
I remember the good old days where we did not have to play around dealing with all this high DPI support a lot of old apps have had to have manifests added and special annoying code to deal with it. Such is evolution to large screens

This framework looks to be for gaming in its intention and not Keynes but an excellent repurposing for sure. Bloat free games would be nice too at any rate.

Does this support Ancient OS like WinXP and Win98 as those have become increasingly difficult to target with late MSVC builds. A 32 bit app that runs perfectly everywhere is a rare finder these days.
Reply With Quote
  #3  
Old 04-10-2020, 04:11
atom0s's Avatar
atom0s atom0s is offline
Family
 
Join Date: Jan 2015
Location: 127.0.0.1
Posts: 396
Rept. Given: 26
Rept. Rcvd 126 Times in 63 Posts
Thanks Given: 54
Thanks Rcvd at 730 Times in 279 Posts
atom0s Reputation: 100-199 atom0s Reputation: 100-199
Some comments on what you've suggested so far. (I'm very familiar with ImGui and use it in multiple game-related projects.)

1. You can cut down the 'bloat' as well by disabling the demo code.
Code:
#define IMGUI_DISABLE_DEMO_WINDOWS
4. Would recommend avoiding file loads of fonts to remove on-disk/installed font requirements. Instead, use ImGui's memory based loaders and store the font in the programs resources or as a raw static array.
Code:
AddFontFromMemoryTTF
AddFontFromMemoryCompressedTTF
AddFontFromMemoryCompressedBase85TTF
5. Keep in mind, the Win32 implementation of this does add some extra things and is part of the example projects and not the core of ImGui. You can find the code for it here:
https://github.com/ocornut/imgui/blob/master/examples/imgui_impl_win32.cpp#L344

Using this setup will also link against gdi32.dll as an extra import.

As for the scaling of things, ImGui has a means of doing these steps globally instead of having to track and handle the scaling yourself per-object/per-font.

For fonts, the ImGui::IO object holds a setting value for this called:
Code:
ImGui::GetIO().FontGlobalScale
For objects, you can alter this to up-scale objects by altering the 'DisplaySize' and adjusting the render buffer while drawing. You can see an explanation of that here:
https://github.com/ocornut/imgui/issues/1786#issuecomment-523332319


As for handling rendering, ImGui is designed for games but can be implemented into [virtually] anything as you are in control of how it renders. There used to be a GDI/GDI+ renderer for it but was discontinued as time went on. For a keygen, this would probably be the ideal framework to use as the renderer instead of Direct3D/OpenGL/SDL to keep resources low (if that matters to you). GDI/GDI+ is also back-supported since Windows XP so it should work on any Windows machine, so the total support coverage will be easier to deal with.

You can find a pull request that is for a GDI renderer here:
https://github.com/ocornut/imgui/pull/2724

I'd recommend using GDI+ instead though for the newer features and better performance.

Along with that, you can also introduce layered window usage if need be to completely remove the window and make things transparent by doing this. You can render ImGui to a GDI+ bitmap/surface and use UpdateLayeredWindow to do the final draw/blit with transparency as needed. (Be sure to render the ImGui scene with the needed transparent color key so the unused/background area is the proper color etc.)
__________________
Personal Projects Site: https://atom0s.com
Reply With Quote
The Following User Gave Reputation+1 to atom0s For This Useful Post:
WhoCares (04-10-2020)
The Following 4 Users Say Thank You to atom0s For This Useful Post:
Abaddon (12-06-2022), chants (04-10-2020), sh3dow (12-07-2022), SinaDiR (04-11-2020)
  #4  
Old 04-10-2020, 13:22
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
thanks for sharing this

Quote:
Originally Posted by atom0s View Post
Some comments on what you've suggested so far. (I'm very familiar with ImGui and use it in multiple game-related projects.)

1. You can cut down the 'bloat' as well by disabling the demo code.
Code:
#define IMGUI_DISABLE_DEMO_WINDOWS
4. Would recommend avoiding file loads of fonts to remove on-disk/installed font requirements. Instead, use ImGui's memory based loaders and store the font in the programs resources or as a raw static array.
Code:
AddFontFromMemoryTTF
AddFontFromMemoryCompressedTTF
AddFontFromMemoryCompressedBase85TTF
5. Keep in mind, the Win32 implementation of this does add some extra things and is part of the example projects and not the core of ImGui. You can find the code for it here:
https://github.com/ocornut/imgui/blob/master/examples/imgui_impl_win32.cpp#L344

Using this setup will also link against gdi32.dll as an extra import.

As for the scaling of things, ImGui has a means of doing these steps globally instead of having to track and handle the scaling yourself per-object/per-font.

For fonts, the ImGui::IO object holds a setting value for this called:
Code:
ImGui::GetIO().FontGlobalScale
For objects, you can alter this to up-scale objects by altering the 'DisplaySize' and adjusting the render buffer while drawing. You can see an explanation of that here:
https://github.com/ocornut/imgui/issues/1786#issuecomment-523332319


As for handling rendering, ImGui is designed for games but can be implemented into [virtually] anything as you are in control of how it renders. There used to be a GDI/GDI+ renderer for it but was discontinued as time went on. For a keygen, this would probably be the ideal framework to use as the renderer instead of Direct3D/OpenGL/SDL to keep resources low (if that matters to you). GDI/GDI+ is also back-supported since Windows XP so it should work on any Windows machine, so the total support coverage will be easier to deal with.

You can find a pull request that is for a GDI renderer here:
https://github.com/ocornut/imgui/pull/2724

I'd recommend using GDI+ instead though for the newer features and better performance.

Along with that, you can also introduce layered window usage if need be to completely remove the window and make things transparent by doing this. You can render ImGui to a GDI+ bitmap/surface and use UpdateLayeredWindow to do the final draw/blit with transparency as needed. (Be sure to render the ImGui scene with the needed transparent color key so the unused/background area is the proper color etc.)
__________________
AKA Solomon/blowfish.
Reply With Quote
  #5  
Old 04-10-2020, 13:25
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
It's ok for WinXP, just use the XP toolchain of MSVC to compile your source code.

as for Win98, far too old to support it, just forget it Life is hard, especially for reversers. so don't waste time on obsolete things


Quote:
Originally Posted by chants View Post
I remember the good old days where we did not have to play around dealing with all this high DPI support a lot of old apps have had to have manifests added and special annoying code to deal with it. Such is evolution to large screens

This framework looks to be for gaming in its intention and not Keynes but an excellent repurposing for sure. Bloat free games would be nice too at any rate.

Does this support Ancient OS like WinXP and Win98 as those have become increasingly difficult to target with late MSVC builds. A 32 bit app that runs perfectly everywhere is a rare finder these days.
__________________
AKA Solomon/blowfish.

Last edited by WhoCares; 04-10-2020 at 13:55.
Reply With Quote
The Following User Says Thank You to WhoCares For This Useful Post:
chants (04-10-2020)
  #6  
Old 06-04-2020, 01:12
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
Keygen for VMware ESXi 7.0, with ImGUI, VS 2019 project.
Attached Files
File Type: zip VMware.Keygen.imgui.zip (499.4 KB, 58 views)
__________________
AKA Solomon/blowfish.
Reply With Quote
The Following User Gave Reputation+1 to WhoCares For This Useful Post:
synkro (06-07-2020)
The Following 9 Users Say Thank You to WhoCares For This Useful Post:
alekine322 (12-08-2022), MarcElBichon (06-04-2020), Mendax47 (06-04-2020), niculaita (06-04-2020), p4r4d0x (06-04-2020), rx3 (12-30-2022), synkro (06-07-2020), uranus64 (12-05-2022), zeuscane (06-05-2020)
  #7  
Old 06-05-2020, 15:34
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
additional info:
you can slightly edit the source code to make keygens for VMware Workstation/Fusion etc.

Just post this to test whether I can edit my own post. The above posts can not be edited due to the forum rules/settings.
__________________
AKA Solomon/blowfish.
Reply With Quote
  #8  
Old 12-05-2022, 15:56
sendersu sendersu is offline
VIP
 
Join Date: Oct 2010
Posts: 1,066
Rept. Given: 332
Rept. Rcvd 223 Times in 115 Posts
Thanks Given: 234
Thanks Rcvd at 512 Times in 288 Posts
sendersu Reputation: 200-299 sendersu Reputation: 200-299 sendersu Reputation: 200-299
@WhoCares
do you have plans to add support for VmW workstation products?

2) MS is complaining about using CryptXXX WinAPI as follows:

Important This API is deprecated. New and existing software should start using Cryptography Next Generation APIs. Microsoft may remove this API in future releases.

Last edited by sendersu; 12-05-2022 at 16:47.
Reply With Quote
  #9  
Old 12-07-2022, 20:16
WhoCares's Avatar
WhoCares WhoCares is offline
who cares
 
Join Date: Jan 2002
Location: Here
Posts: 409
Rept. Given: 10
Rept. Rcvd 16 Times in 14 Posts
Thanks Given: 41
Thanks Rcvd at 155 Times in 61 Posts
WhoCares Reputation: 17
Here is the updated for vmware workstation 17

I successfully build it with vs2019 and vs2022, windows sdk 10, there is no deprecation warnings/errors.
We can still use crypto api though MS doc says it's deprecated.

and, you can replace the SHA1 hasher and strong random number generator with openssl functions. or only use the weak RNG( CRT rand() function ).

Quote:
Originally Posted by sendersu View Post
@WhoCares
do you have plans to add support for VmW workstation products?

2) MS is complaining about using CryptXXX WinAPI as follows:

Important This API is deprecated. New and existing software should start using Cryptography Next Generation APIs. Microsoft may remove this API in future releases.
Attached Files
File Type: rar VMware.Keygen.imgui.rar (454.9 KB, 40 views)
__________________
AKA Solomon/blowfish.
Reply With Quote
The Following 4 Users Say Thank You to WhoCares For This Useful Post:
alekine322 (12-08-2022), cr0bar (09-27-2023), niculaita (12-08-2022), sendersu (12-07-2022)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cracking .NET Framework applications dee General Discussion 1 01-16-2003 03:02


All times are GMT +8. The time now is 18:08.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )