- NSIS Discussion
- Playing the System.dll thing...
Archive: Playing the System.dll thing...
fraefel
30th October 2003 22:06 UTC
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...!
kichik
30th October 2003 22:20 UTC
Use t .r2 instead of ???. this will output the string to $2.
fraefel
30th October 2003 22:31 UTC
System::Call 'mpr::WNetGetConnection(t "x:", t .r2, i ${NSIS_MAX_STRLEN}) i .r1' results in $1 = 487 (Errorcode), $2 is empty...
kichik
30th October 2003 22:35 UTC
That one is because you've left out the * before i in the third parameter. It's a pointer, so it must be there.
deguix
30th October 2003 22:35 UTC
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.
kichik
30th October 2003 22:37 UTC
The dot should be there, deguix. We want the output, not to send input.
fraefel
30th October 2003 22:39 UTC
Works - thx for the quick help ! Keep on the nice work - looking gooood! :D
fraefel
30th October 2003 23:11 UTC
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 !
kichik
30th October 2003 23:14 UTC
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.
fraefel
30th October 2003 23:21 UTC
Thanks for the link - I'll have a look !
deguix
31st October 2003 01:28 UTC
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: )