Jump to content

DriveGetType Crashes


Recommended Posts

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

  • Developers

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

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

  • Developers

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

  • Moderators

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

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

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

  • 3 months later...

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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...