CallWin32_Immediate
(SWI &C1001)

On entry: 
R0 =  Pointer to zero-terminated API descriptor string
R1 =  Number of parameters being passed
R2 to R8 =  Parameters to send
On exit:
R0 =  Result code of Win32 call (if valid)
R1 =  Result of GetLastError() after Win32 call
Interrupts: Interrupt status is unaltered
Fast interrupts are enabled
Processor Mode:  Processor is in SVC mode
Re-entrancy: SWI is reentrant (disables IRQs for duration of SWI)
Use: This call immediately executes a Win32 API as specified by R0 with the parameters specified by R2 to R8. Obviously, you can only pass 32 bit integer parameters - however, many Win32 API calls require just that. If you need to pass blocks of data eg; strings then please use CallWin32_WithPars.

The descriptor string is of the following format:

<calling convention>:<dll name>::<mangled API name>

Calling convention is how the API is called - under Win32, there can be stdcall, cdecl and fastcall. Only stdcall or cdecl is currently supported (all Win32 functions are stdcall).

WARNING: Passing an incorrect R1 (ie; no of parameters) with stdcall will crash Red Squirrel.

DLL name is whatever DLL or EXE whose exported API you wish to call. This could be kernel32 or user32 for example. See the specification for the Win32 function LoadLibrary() for more information.

Mangled API name is whatever is literally exported from the DLL. That is not the same as the API's name. MSVC for example decorates the symbol according to parameter number and calling convention whereas C++ produces very managed symbols. Kernel calls have a 'A' or a 'W' appended depending on ANSI or Unicode versions - you always want ANSI. Use something like the "Depends" tool with MSVC to determine what exactly the exported symbol is for any given DLL or EXE.

Related SWIs: None