NO

Author Topic: InitCommonControlsEx  (Read 3322 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: 536
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: 2091
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: 2091
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