CoGetModuleType

Go to Home Page

Determines the type of module a file path references

Syntax

HRESULT WINAPI CoGetModuleType (
    LPCWSTR pwszFile,
    int* pModuleType
)

Parameters

pwszFile
The file whose module type is being queried
pModuleType
Pointer to a value that receives the module type. This parameter cannot be NULL. On return, this value will be 1 if the module is an x86 module, and 2 if it is either a x64 or a IA64 module.

Return Value

S_OK on success, standard COM error on failure

Remarks

The determination is made by mapping the file into memory and attempting to interrogate the NtHeader->FileHeader.Machine.

If the file exists but is not of an acceptable format, the function returns HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT).