CIG_Support Posted October 5, 2017 Share Posted October 5, 2017 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 5, 2017 Developers Share Posted October 5, 2017 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 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CIG_Support Posted October 5, 2017 Author Share Posted October 5, 2017 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted October 5, 2017 Developers Share Posted October 5, 2017 That snippet doesn't really run. Maybe you can post something that will run so I can have a play? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CIG_Support Posted October 5, 2017 Author Share Posted October 5, 2017 I was showing where exactly it crashed, My code is 528 lines long. :-) Let me whip up something really small that you can execute. Link to comment Share on other sites More sharing options...
AshlandSG Posted October 5, 2017 Share Posted October 5, 2017 (edited) . Edited October 5, 2017 by AshlandSG Wrong account used Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 5, 2017 Moderators Share Posted October 5, 2017 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
CIG_Support Posted October 5, 2017 Author Share Posted October 5, 2017 I changed firms. Out of habit, I entered my former firm's credential. My correct one is CIG_Support. Another tech took over AshlandSG. Link to comment Share on other sites More sharing options...
CIG_Support Posted October 5, 2017 Author Share Posted October 5, 2017 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. Link to comment Share on other sites More sharing options...
CIG_Support Posted January 25, 2018 Author Share Posted January 25, 2018 I was still getting errors on DriveGetType since then but have been ignoring it due to time constraint. However, I've now figured out a permanent solution and hope this helps others facing the same error. Keep in mind this only affects users running admin elevated mode, which is exactly what happens with the GPO logon scripts. Standard users appear to be unaffected. First, check if the path exists with the FileExists command. If it doesn't exist then don't do the DriveGetType. That's it. Such a simple workaround. Have fun! Gianni 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now