﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1032	_winapi_getlasterror and _winapi_getlasterrormessage do not work as expected	SeraphTC		"I am testing this as follows:

I have a drive (X:) mapped to \\server\share1 with my domain user credentials.

I wish to cause an error by mapping another drive (Z:) to \\server\share2 with domain admin user credentials.

code:
;-------------------------------------------------------------------
#include <winapi.au3>

$result = drivemapadd(""Z:"",""\\server\share2"",0,""domain\admin"",""adminpword"")
msgbox(0,""Map Result"",$result & "" : "" & _winapi_getlasterror() & "" : "" & _winapi_getlasterrormessage())
exit
;-------------------------------------------------------------------

This produces the following message:

0 : 1219 : Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.  Disconnect all previous connections to the server or shared resource and try again.

This is as expected.  However, if we change the code so it includes a variable, like so:

;-------------------------------------------------------------------
#include <winapi.au3>

$mapthis = inputbox(""Map A Drive"",""Enter the Path you wish to Map"")
$result = drivemapadd(""Z:"",$mapthis,0,""domain\admin"",""adminpword"")
msgbox(0,""Map Result"",$result & "" : "" & _winapi_getlasterror() & "" : "" & _winapi_getlasterrormessage())
exit
;-------------------------------------------------------------------

We now get the following (incorrect) message:

0 : 0 : The operation completed successfully

It appears that the _winapi_getlasterror and _winapi_getlasterrormessage functions get screwed up by the variable call, (which IS successful) and subsequently appear to report that the drivemapadd process succeeded, when it did not.
"	Bug	closed		AutoIt	3.3.0.0	None	No Bug		seraph@…
