Modify

Opened 15 years ago

Closed 15 years ago

#1032 closed Bug (No Bug)

_winapi_getlasterror and _winapi_getlasterrormessage do not work as expected

Reported by: SeraphTC Owned by:
Milestone: Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: Cc: seraph@…

Description

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.

Attachments (0)

Change History (1)

comment:1 Changed 15 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

You should not be mixing native AutoIt functions and the Windows API. This is not supported. This is not a bug.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.