# hx\_ForceCallType

## Description

Tell the decompiler to skip analyzing the call arguments and instead use the type of the called object as-is. In some cases, especially for indirect calls, the decompiler cannot correctly detect call arguments. For a call like:

```
        push something
        mov  eax, [ecx]
        call [eax+8]
```

it is very difficult to determine where are the input arguments. For example, it is unclear if ECX is used by the call or not.

However, the number of arguments and their types can become available at later stages of decompilation. For example, the decompiler may determine that ECX points to a class with a table of virtual functions. If the user specifies the vtable layout, the output may become similar to:

```
        ((int (*__stdcall)(DWORD))ptr-vftable-somefunc)(v1);
```

If the user declares somefunc as a pointer to a function like this:

```
        int __thiscall (*somefunc)(myclass *obj, int arg);
```

then the code is incorrect. The decompiler detected only one argument and missed the one in ECX.

The *Force call type* command instructs the decompiler not to perform the call argument analysis but just use the type of the call object. For the above example, the call will be transformed into something like:

```
        ptr-vftable-somefunc(obj, v1);  // obj is in ECX
```

In other words, this command **copies the call type from the call object to the call instruction**. The call object may be any expression, the only requirement is that it must be a pointer to a function.

There is a more general command *Set call type...* (Action name: `hx:SetCallType`) that allows the user to set any type for a call instruction.

{% hint style="info" %}
Behind the scenes, the 'force call' command copies the desired type to the operand of the call instruction. To revert the effects of 'force call' or to fine tune the forced type please use the **Edit, Operand type, Set operand type** in the disassembly view while staying on the call instruction.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hex-rays.com/ida-actions/hx_forcecalltype.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
