Archive: How to use WinApi's Addmonitor() in nsis


How to use WinApi's Addmonitor() in nsis
I just want to know how to set these three parameters
in Nsis.thank you very much.
here is the function's basic information.

AddMonitor

The AddMonitor function installs a local port monitor and links the configuration, data, and monitor files.

BOOL AddMonitor(
LPTSTR pName, // server name
DWORD Level, // monitor information level
LPBYTE pMonitors // monitor information buffer
);

Parameters

pName
[in] Pointer to a null-terminated string that specifies the name of the server on which the monitor should be installed. For systems that support only local installation of monitors, this string should be NULL.
Level
[in] Specifies the version of the structure to which pMonitors points. This value must be 2.

pMonitors
[in] Pointer to a MONITOR_INFO_2 structure. If the pEnvironment member of the pMonitors structure is NULL, the current environment of the caller (client), not of the destination (server), is used.

Windows 95/98/Me: pEnvironment must not be NULL. Instead, the recommended value is "Windows 4.0".

Note that the call will fail if the environment does not match the environment of the server, that is, you can only add a monitor that was written for the architecture of the server.

Return Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


Using the System plug-in.

System::Call "*(t 'name', t 'env', t 'dll') i .r0"
System::Call "winspool::AddMonitor(t 'server name', i 2, i r0)"
System::Free $0

Thank You kichik!