I disassemble CreateDevice function from my DirectX code and commented each paratemer:
.text:0043F485 mov eax, [ebp+lpParam]
.text:0043F488 add eax, 730h
.text:0043F48D push eax ;LPDIRECT3DDEVICE9
.text:0043F48E mov ecx, [ebp+lpParam]
.text:0043F491 add ecx, 0B88h
.text:0043F497 push ecx ;D3DPRESENT_PARAMETERS
.text:0043F498 mov edx, [ebp+var_170]
.text:0043F49E push edx ;vertex processing type
.text:0043F49F mov eax, [ebp+lpParam]
.text:0043F4A2 mov ecx, [eax+728h]
.text:0043F4A8 push ecx ;hWnd
.text:0043F4A9 push 1 ;D3DDEVTYPE_HAL
.text:0043F4AB push 0 ;D3DADAPTER_DEFAULT
.text:0043F4AD mov edx, [ebp+lpParam]
.text:0043F4B0 mov eax, [edx+734h]
.text:0043F4B6 mov ecx, [ebp+lpParam]
.text:0043F4B9 mov edx, [ecx+734h]
.text:0043F4BF mov eax, [eax]
.text:0043F4C1 push edx ;??????????????
.text:0043F4C2 mov ecx, [eax+40h] ;this pointer
.text:0043F4C5 call ecx ;call CreateDevice
.text:0043F4C7 mov eax, [ebp+lpParam]
.text:0043F4CA mov ecx, [eax+730h];LPDIRECT3DDEVICE9 in return
Using experimental way I figured out LPDIRECT3DDEVICE9 variable presents in:
.text:0043F48D push eax ;LPDIRECT3DDEVICE9
Also, using debugger I figured out edx register:
.text:0043F4C1 push edx ;??????????????
has value d3d9.dll:6521F191 db 0B8h what in expand view is:
d3d9.dll:6521F191 db 0B8h ; ¬
d3d9.dll:6521F192 db 48h ; H
d3d9.dll:6521F193 db 77h ; w
d3d9.dll:6521F194 db 23h ; #
My question, why before CreateDevice function calling is there "push edx" line of code? In my example I used OOP and ecx is this pointer:
.text:0043F4C2 mov ecx, [eax+40h] ;this pointer
But what purpose is this line of code:
.text:0043F4C1 push edx ;d3d9.dll:6521F191 db 0B8h ; ¬
Is it like this pointer for DirectX COM interface or what?
Thanks in advance!