Archive: Playing the System.dll thing...


Playing the System.dll thing...
Hi !

Can anyone give me the right path to get
the API Call WNetGetConnection running through System.dll ?

System::Call 'mpr::WNetGetConnection(t "x:", ???, i ${NSIS_MAX_STRLEN}) i .r1'. I've tried a few things at the place of ???, but the function keeps returning error code ($1) 487 (Attempt to access invalid address.)

The API syntax looks like:
DWORD WNetGetConnection(
LPCTSTR lpLocalName,
LPTSTR lpRemoteName,
LPDWORD lpnLength
);

Anyone to help ? :confused:

Thx in advance, especially Brainsucker for the system.dll...!


Use t .r2 instead of ???. this will output the string to $2.


System::Call 'mpr::WNetGetConnection(t "x:", t .r2, i ${NSIS_MAX_STRLEN}) i .r1' results in $1 = 487 (Errorcode), $2 is empty...


That one is because you've left out the * before i in the third parameter. It's a pointer, so it must be there.


Don't put the dot before the variable (except when returning values), so:

System::Call 'mpr::WNetGetConnection(t "x:", t r2, *i ${NSIS_MAX_STRLEN}) i .r1'

$2 have to be a valid remote drive value to be connected to.
$1 will return the result.


The dot should be there, deguix. We want the output, not to send input.


Works - thx for the quick help ! Keep on the nice work - looking gooood! :D


Sorry to bother you again; but I'm having trouble getting a structure filled; trying to use:
NET_API_STATUS NetWkstaUserGetInfo(
LPWSTR reserved,
DWORD level,
LPBYTE* bufptr
);

bufptr points to a WKSTA_USER_INFO_1 structure which looks like this:
typedef struct _WKSTA_USER_INFO_1 { LPWSTR wkui1_username; LPWSTR wkui1_logon_domain; LPWSTR wkui1_oth_domains; LPWSTR wkui1_logon_server;
} WKSTA_USER_INFO_1, *PWKSTA_USER_INFO_1, *LPWKSTA_USER_INFO_1;

Tried to do a System::Call 'netapi32::NetWkstaUserGetInfo(n,i 1,*w .r2,*w .r3,*w .r4,*w .r5) i .r1'

It returns without errors, but the $2-5 isn't filled correctly...?

Thx in advance !


You should allocate a structure for that. You can do it all in one line. Take a look at the examples. Search for WNDCLASS and you should find what you need.


Thanks for the link - I'll have a look !


The dot should be there, deguix. We want the output, not to send input.
Low time to think + low time to look around other pages = More change to wrong answers

(I'm thinking to do an example of Math plugin use... now that I learned some useful things about it... great plugin! :up: )