NO

Author Topic: InitCommonControlsEx  (Read 2115 times)

Jokaste

  • Guest
InitCommonControlsEx
« on: October 30, 2017, 11:12:36 am »
This code is bad:
Code: [Select]

                     call   InitCommonControlsEx
                     call   InitCommonControls

it would have been written like this:

Code: [Select]
                     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.

Offline jj2007

  • Member
  • *
  • Posts: 516
Re: InitCommonControlsEx
« Reply #1 on: October 30, 2017, 11:39:54 am »
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

  • Guest
Re: InitCommonControlsEx
« Reply #2 on: October 30, 2017, 12:12:53 pm »
The RCX register is initialized before any push
I suppose the RSP register is not in the form the function is waiting for.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1899
Re: InitCommonControlsEx
« Reply #3 on: October 30, 2017, 12:24:44 pm »
What for is that InitCommonControls() when InitCommonControlsEx() was used?
InitCommonControls() only load that COMCTL32.dll ?
May the source be with you

Jokaste

  • Guest
Re: InitCommonControlsEx
« Reply #4 on: October 30, 2017, 12:27:03 pm »
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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1899
Re: InitCommonControlsEx
« Reply #5 on: October 30, 2017, 12:47:45 pm »
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.

Code: [Select]
InitCommonControls:
ret
nop
nop
...
May the source be with you