CIG_Support

DriveGetType Crashes

9 posts in this topic

#1 ·  Posted

I have a code that calls DriveGetType.  For standard user accounts, it works fine.  For admin accounts, it crashes on this particular statement.  I already check for errors returned from this statement but that doesn't help if that statement crashes.  So, I enabled error-trapping ObjEvent before DriveGetType and got the following error:  Number 1, Description = "The directory property cannot be found in the cache."  Should not DriveGetType do its own error trapping?  What's the point of it returning an error if it doesn't do that?

This isn't exactly about the error itself but more of the DriveGetType not doing its own error-trapping.  I know that the error is related to UAC, network UNC, Trusted Sites, etc.  I've confirmed I got all those right, including signing the executable, but still get this error.  I'm still troubleshooting this odd error and would appreciate any input from those who understands this type of error.  Probably will have to replace DriveGetType with something else.

Share this post


Link to post
Share on other sites



#2 ·  Posted

I curious how the error trapping would work with DriveGetType as that only works on Com events.
Maybe start with showing the script you are testing with and what you mean with crash?

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Snippet of code:

$oTrapError = ObjEvent ("AutoIt.Error", "TrapError")
$sGotData = DriveGetType ($sDrive)
If @error Then ReportError ($cTraceL, "DriveGetType failed. Error code: " & @error & ", Description: " & $sTrapErrorDesc)
SetError (0)
$oTrapError.stop
$oTrapError=0

All the variables are defined, e.g., $sDrive passed as a parameter to this function, $oTrapError and $sTrapErrorDesc are global variables.  TrapError is another function that is called whenever an error occurs.  All it does is copy the object's error number and description into @error and $sTrapErrorDesc respectively.

When you run this under an admin account with UAC enabled and pass along "N:", for example, the statement DriveGetType crashes right there.  Without the error-trapping function, I would only see line number for where the error happened, no explanation.

Share this post


Link to post
Share on other sites

#5 ·  Posted

I was showing where exactly it crashed,  My code is 528 lines long. :-)   Let me whip up something really small that you can execute.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

.

Edited by AshlandSG
Wrong account used

Share this post


Link to post
Share on other sites

#7 ·  Posted

CIG_Support & AshlandSG,

Same IP for both accounts and pretty obviously the same person posting. As multiple accounts are strictly forbidden in the Forum rules, would you care to explain just what is going on?

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

I changed firms.  Out of habit, I entered my former firm's credential.  My correct one is CIG_Support.  Another tech took over AshlandSG.

Share this post


Link to post
Share on other sites

#9 ·  Posted

After snipping the code down to 28 lines, I could not make DriveGetType generate an error.  The description that I got appears to be related to Active Directory even though DriveGetType activate that error.  I do use Active Directory commands elsewhere and I'm left wondering if one of the "opened" objects is somehow causing issues with DriveGetType even though I don't think they're related.

The program ran fine since January 2014.  It's only after the last Patch Tuesday Windows update that this start happening.  And, only happens within GPO Logon Script, and specifically only for admin accounts.  Works just fine running in both elevated and standard command prompt for admins, just not during logons.

It's going to take me too long to drill down the exact cause.  Since I now have my own error-trapping and standard users are not affected by this, I'm not going to worry about it any longer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now