News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Icon scaling

Started by kkurkiewicz, September 14, 2023, 07:19:37 AM

Previous topic - Next topic

HSE

If original 64 bits program look different than in development 32 bit application, conclusion is: WOW64 is not using same resize method than 64 bits API.  :thumbsup:
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on September 15, 2023, 02:39:21 AMIf original 64 bits program look different than in development 32 bit application, conclusion is: WOW64 is not using same resize method than 64 bits API.  :thumbsup:

That's an interesting theory. So, if an identical program would be built a) as 64-bit, b) as 32-bit application, its icon would look different? Can I have an icon to demonstrate this, please?

include \Masm32\MasmBasic\Res\JBasic.inc
wcx WNDCLASSEX <WNDCLASSEX, CS_HREDRAW or CS_VREDRAW or CS_OWNDC, WndProc, 0, 0, 1, 2, 3, COLOR_BTNFACE+1, 0, txClass, SIZE_P>
txClass db "JBasicGUI", 0 ; OPT_64 1 ; 0=32-bit, 1=64-bit assembly
Init
WinMain proc
LOCAL msg:MSG
  wc equ [rbx.WNDCLASSEX] ; we use an equate for better readability
  lea rbx, wcx
  mov wc.hInstance, rv(GetModuleHandle, 0)
  mov wc.hIcon, rv(LoadIcon, rax, IDI_APPLICATION) ; click on the first Rsrc bookmark to change the icon
  mov wc.hIconSm, rax ; the rv macro returns results in rax
  mov wc.hCursor, rv(LoadCursor, NULL, IDC_ARROW) ; get a cursor
  jinvoke RegisterClassEx, rbx ; the window class needs to be registered
  wsStyle=WS_OVERLAPPEDWINDOW or WS_VISIBLE or WS_CLIPCHILDREN
  jinvoke CreateWindowEx, 0, wc.lpszClassName, Chr$("Hello World"), wsStyle, 300+320*@64, 127, 300, 200, NULL, rv(LoadMenu, wc.hInstance, 100), wc.hInstance, NULL
  msgLoop: inc eax
shr eax, 1
je @F ; quit if GetMessage returned 0 (exit OK) or -1 (error), or if CwEx failed
  jinvoke TranslateMessage, addr msg ; translates virtual-key messages into character messages
jinvoke DispatchMessage, addr msg ; dispatches a message to a window procedure
jinvoke GetMessage, addr msg, 0, 0, 0 ; retrieve a message from the queue, and return a BOOL
  jmp msgLoop
@@: jinvoke ExitProcess, msg.wParam
WinMain endp
WndProc proc uses rsi rbx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL ps:PAINTSTRUCT, MyR4:REAL4
  Switch_ uMsg
  Case_ WM_DESTROY: jinvoke PostQuitMessage, NULL ; quit after WM_CLOSE
  Endsw_
  jinvoke DefWindowProc, hWnd, uMsg, wParam, lParam ; default processing
  ret
WndProc endp
EndOfCode

HSE

Equations in Assembly: SmplMath

kkurkiewicz

OK, I'll try resizing the icon using Axialis and see what happens, thank you.
Kamil

kkurkiewicz

And for those who would like to see the icon, you can find it in the attachment below.
Kamil

NoCforMe

Viewing Zedd's smallerized (32x32) icon, at least in Axialis's preview, it looks more like the IDA one (better) than yours (fuzzy). Let us know what it looks like displaying the smaller one.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: HSE on September 15, 2023, 02:39:21 AMIf original 64 bits program look different than in development 32 bit application, conclusion is: WOW64 is not using same resize method than 64 bits API.  :thumbsup:

Here is Ida.ico, in 64- and 32-bit executables. See the difference?

kkurkiewicz

Quote from: NoCforMe on September 15, 2023, 05:46:15 AMViewing Zedd's smallerized (32x32) icon, at least in Axialis's preview, it looks more like the IDA one (better) than yours (fuzzy). Let us know what it looks like displaying the smaller one.
It is a little smoother, but it still looks lousy.

Kamil

zedd151

Quote from: kkurkiewicz on September 15, 2023, 05:56:51 AMIt is a little smoother, but it still looks lousy.

We have no idea at this point what apis or libraries that ida uses to display its icon (custom drawn?). But I agree, it looks better than the others.

NoCforMe

Quote from: jj2007 on September 15, 2023, 05:53:09 AM
Quote from: HSE on September 15, 2023, 02:39:21 AMIf original 64 bits program look different than in development 32 bit application, conclusion is: WOW64 is not using same resize method than 64 bits API.  :thumbsup:

Here is Ida.ico, in 64- and 32-bit executables. See the difference?

No, because there isn't any. (I checked a blown-up image. The two are identical.) But Jochen, these are 16x16 icons.

I guess we really need to find out, somehow, exactly how Windoze is rendering these images on his window. Anyone have any ideas? Disassembly? Or how about using my strings program (attached) to see what Windows functions are being used in the executable? (This just pulls out all ASCII strings from a file and displays them.)
Assembly language programming should be fun. That's why I do it.

jj2007

#25
Quote from: NoCforMe on September 15, 2023, 06:10:01 AMThe two are identical. But Jochen, these are 16x16 icons.

Yes and no. It's a 128x128 icon, but Windows scales it down to 16x16 to let it fit into the caption. And it scales it down to 32x32 if you use Alt Tab.

I'd like to see one example where Windows uses the full 128x128. And don't come up with an icon editor, because I would consider that cheating. I mean an actual use of this icon beyond 32x32.

:smiley:

zedd151

Quote from: NoCforMe on September 15, 2023, 06:10:01 AMI guess we really need to find out, somehow, exactly how Windoze is rendering these images on his window. Anyone have any ideas?
Exactly. Without knowing how ida does it, no one can help kkurkiewicz with his dilemma.
Custom drawn window using GDI+ would be my guess.  Without knowing though, it is just speculation on my part.

Caché GB

IDA uses QtCore, QtGui and QtXml. You would need to look to those to find out what is going on.
IDA and Qt most likely have there own proprietary image storage/image manipulation solutions
for there user interfaces.

To see an example of the full size icon in use : Explorer -> View -> (in the Explorer ribbon) -> click "Extra Large Icons"



Caché GB's 1 and 0-nly language:MASM

HSE

 :biggrin: Here no differences between 32, 64 or original IDA64.exe

Equations in Assembly: SmplMath

jj2007

#29
Quote from: Caché GB on September 15, 2023, 07:16:28 AMIDA uses QtCore, QtGui and QtXml. You would need to look to those to find out what is going on.
IDA and Qt most likely have there own proprietary image storage/image manipulation solutions
for there user interfaces.

To see an example of the full size icon in use : Explorer -> View -> (in the Explorer ribbon) -> click "Extra Large Icons"

You don't need QT, simple Win32 is enough. "Extra Large Icons" is 64x64, but this is 128x128: