Everhart, Glenn From: Venkatesh R. [venkat@amiindia.co.in] Sent: Thursday, January 14, 1999 12:21 AM To: 'John Losche'; ntfsd; ntdev Subject: RE: [ntdev] deleting dir objects created with ZwCreateDirectoryOb ject not working? hi john, 1. did u check the return value of ZwClose() - success/failure. 2. u said that the next time ZwCreateDirectoryObject is called it fails - what do u meab by next time . (ie) after rebooting the system or immd after unloading the driver. if its after rebooting the system then its needs more efort to debug the system .if its not then it means that ZwClose has not succeeded. Also Try OBJ_OPENIF instead of OBJ_PERMANENT Hope this helps. Give a reply if its works out. Venkatesh American Megatrends Inc India > -----Original Message----- > From: John Losche [SMTP:jlosche@bolix.com] > Sent: Wednesday, January 13, 1999 11:53 PM > To: ntfsd; ntdev > Subject: [ntdev] deleting dir objects created with > ZwCreateDirectoryObject not working? > > This may be my week for obvious questions but.... I am creating a dir > object to put some > device names in, which should be deleted in my unload function, but is > not. > > So I am creating a dir object using: > > // Create an object attributes structure. > InitializeObjectAttributes(&DirectoryAttributes, > &DirectoryName, OBJ_PERMANENT, > NULL, NULL); > > // The following call will fail if we do not have appropriate > privileges. > if (!NT_SUCCESS(RC = ZwCreateDirectoryObject(PtrReturnedHandle, > DIRECTORY_ALL_ACCESS, > &DirectoryAttributes)) ) { > return RC; > } > > ZwMakeTemporaryObject(PtrReturnedHandle); > > DosDirectoryHandle = *PtrReturnedHandle; > > I create a device name in that directory, all of this works. > > In my unload: > > IoDeleteSymbolicLink(&ctlp->UserVisibleName); // of the device > > IoDeleteDevice(ctlp->myDeviceObject); > > if (ctlp->DosDirectoryHandle) { > ZwClose(ctlp->DosDirectoryHandle); > ctlp->DosDirectoryHandle = NULL; > } > > From the DDK docs, this should decrement to reference count to 0 and > delete > the dir object, it does'nt. > So the next time I start the driver the ZwCreateDirectoryObject call > fails, > because the dir object already exists. > > Any ideas???? > > Thanks, > John Losche > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > [ To unsubscribe, send email to ntdev-request@atria.com with body > UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]