InitCommonControlsEx

Started by Jokaste, October 30, 2017, 11:12:36 AM

Previous topic - Next topic

Jokaste

This code is bad:


                     call   InitCommonControlsEx
                     call   InitCommonControls

it would have been written like this:


                     mov      rax,OFFSET SomeWhere
                     push   rax
                     mov      rax,OFFSET InitCommonControls
                     push   rax
                     jmp      InitCommonControlsEx
SomeWhere :


"InitCommonControlsEx" must be the last because I initialize RCX register with a pointer on a structure.
In theory it's good, but in practice it crashes without me having any idea of the cause! So if anyone has an idea I accept it.

jj2007

InitCommonControlsEx takes one parameter, a pointer to the structure, and in 64-bit code you must pass it in rcx, not on the stack.

Jokaste

The RCX register is initialized before any push
I suppose the RSP register is not in the form the function is waiting for.

TimoVJL

What for is that InitCommonControls() when InitCommonControlsEx() was used?
InitCommonControls() only load that COMCTL32.dll ?
May the source be with you

Jokaste

For common controls and for themes.


Quote
Registers and initializes certain common control window classes. This function is obsolete. New applications should use the InitCommonControlsEx

TimoVJL

InitCommonControls() is only a stub function for reference comctl32.dll.
You don't have to call it, if that dll is already referenced by import library.

InitCommonControls:
ret
nop
nop
...
May the source be with you