DirectoryEntryAttribute(0) returns 65568

Windows specific forum
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

DirectoryEntryAttribute(0) returns 65568

Post by Zebuddi123 »

Hi All

I have a problem where i have a file supposedly in a directory, but windows fails to see it ie explorer.exe i have ran ubuntu 10.10 live cd and ubuntu failed to see it also :O allthough each time i run any routine or program created by pb that i have it see`s the file "NFC.xml". so i wrote

Code: Select all

Directory$ = "C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\" 
If ExamineDirectory(0, Directory$, "*.*")  
	While NextDirectoryEntry(0)
		If DirectoryEntryType(0) = #PB_DirectoryEntry_File
			FileAttributes = DirectoryEntryAttributes(0)
			If FileAttributes <>32
				Debug "This file is hidden   "+ DirectoryEntryName(0)+"  "+ Str(FileAttributes)
			EndIf
			Debug DirectoryEntryName(0) + "      "+Str(FileAttributes)
			Debug ""
		EndIf
	Wend
	FinishDirectory(0)
EndIf
this see`s the file and identifies the attributes of "NFC.xml" as 65568 where all the other files are 32 and all otherfiles are visible ?

any help idea would be appreciated

zebuddi
malleo, caput, bang. Ego, comprehendunt in tempore
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: DirectoryEntryAttribute(0) returns 65568

Post by IdeasVacuum »

Can you open the file in an editor?

A 'normal' hidden read-write file would have an attribute of 34 (on Win32). If you do a Google search, 65568 has a long list but I have no idea why you see that attribute number - perhaps you could link to the file so that others can verify it on their system?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DirectoryEntryAttribute(0) returns 65568

Post by luis »

Shot version: I don't have a clue.

Long version:

On PB the documented return values are

#PB_FileSystem_Hidden : File is hidden
#PB_FileSystem_Archive : File has been archived and not changed since the last time
#PB_FileSystem_Compressed: File is compressed
#PB_FileSystem_Normal : Normal attributes
#PB_FileSystem_ReadOnly : File is in readonly mode
#PB_FileSystem_System : File is a system file

and even adding the undocumented ones (but available in the winapi) you got this:

Code: Select all

Debug #PB_FileSystem_ReadOnly  
Debug #PB_FileSystem_Hidden    
Debug #PB_FileSystem_System   
Debug #PB_FileSystem_Archive   
Debug #PB_FileSystem_Normal    
Debug #FILE_ATTRIBUTE_TEMPORARY
Debug #FILE_ATTRIBUTE_SPARSE_FILE
Debug #FILE_ATTRIBUTE_REPARSE_POINT
Debug #PB_FileSystem_Compressed
Debug #FILE_ATTRIBUTE_OFFLINE
Debug #FILE_ATTRIBUTE_ENCRYPTED
all numbers between 1 and 16384, so I don't have idea why you get such a large value, maybe some attribute flag I don't know about ?

Hopefully someone else will give you a better answer.
"Have you tried turning it off and on again ?"
Thorium
Addict
Addict
Posts: 1308
Joined: Sat Aug 15, 2009 6:59 pm

Re: DirectoryEntryAttribute(0) returns 65568

Post by Thorium »

Sounds like a error in the file system. Try run Scandisk or another tool that searches disk errors.
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: DirectoryEntryAttribute(0) returns 65568

Post by breeze4me »

http://msdn.microsoft.com/en-us/library ... s.85).aspx
FILE_ATTRIBUTE_VIRTUAL
65536 (0x10000)

This value is reserved for system use.
maybe #FILE_ATTRIBUTE_VIRTUAL|#FILE_ATTRIBUTE_ARCHIVE = 65568 ?
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: DirectoryEntryAttribute(0) returns 65568

Post by Zebuddi123 »

Thanks Luis, IdeasVacuum, Thorium, breeze4me for the reply's

I copied the NFC.xml & NFC.jar into the folder to overwrite anything that might be there DirectoryEntryAttributes() still showed NFC.xml 65568 and NFC.jar 32
both files where visible in explorer after

did a shift Delete on the whole folder reinstalled b4a (Basic4Android) installing standard libs ran the program i have written to install new libs for b4a from zip files installed NFC.xml .

ran DirectoryEntryAttributes() and all is ok NFC.xml = 32 and visible through explorer.exe. Very strange. that even after reboot and running ubuntu 10.10 live cd
that neither linux nor win os could not see the file. but PB does !!! and pull attributes

So the return from DirectoryEntryAttributes() is OR`ed ? is this correct

Thanks
zebuddi
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DirectoryEntryAttribute(0) returns 65568

Post by luis »

@Zebuddi123

Yes, the flags are OR'ed to make the final value.

@breeze4me

Ah, interesting never saw that value, thanks !
"Have you tried turning it off and on again ?"
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DirectoryEntryAttribute(0) returns 65568

Post by luis »

FILE_ATTRIBUTE_VIRTUAL

it seem to have to do with the file virtualization introduced with Window Vista.

Since the file was under "C:\Program Files (x86)\" maybe it was not really written there but somewhere else and "virtualized", hence the attribute, this would explain why a live linux cd didn't see the file there.

Or something like that :)

See "File Virtualization" http://msdn.microsoft.com/en-us/library/bb756960.aspx
"Have you tried turning it off and on again ?"
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: DirectoryEntryAttribute(0) returns 65568

Post by Zebuddi123 »

luis

think you`ve hit the nail on the head. i remember searching for NFC.xml via "everything search engine" and it pulling up something with a virtual in the directory path name did`nt take much notice of it

but found C:\Users\zebuddi\AppData\Local\VirtualStore\Program Files (x86)\Anywhere Software\Basic4android\Libraries\NFC.xml

what do you think ?

looks like it could be the case and the file returns 32 from that directory

yes it is !!!

just made sure that the NFC.xml file did not exist in c:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\ but it exists in C:\Users\zebuddi\AppData\Local\VirtualStore\Program Files (x86)\Anywhere Software\Basic4android\Libraries\ and returns 65568

Deleted C:\Users\zebuddi\AppData\Local\VirtualStore\Program Files (x86)\Anywhere Software\Basic4android\Libraries\NFC.xml ran test file does not exist

So riddle Solved :)


Thanks :D
Zebuddi
Last edited by Zebuddi123 on Sat Feb 18, 2012 9:05 pm, edited 2 times in total.
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: DirectoryEntryAttribute(0) returns 65568

Post by luis »

That's it.

Thanks to breeze4me for pointing out the existence of the flag :)
"Have you tried turning it off and on again ?"
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: DirectoryEntryAttribute(0) returns 65568

Post by Zebuddi123 »

What was happening is that if your program does not have administrative rights to install files other than in public user space. a virtual directory is created in
C:\Users\zebuddi\AppData\Local\VirtualStore + appendage ie C:\Users\zebuddi\AppData\Local\VirtualStore + \Pragram Files x86\purebasic\libraries which would be a direct reflection of the directory path of the program you are using \ writiing too etc.

because this is a virtual path the file attributes assigned to the file returns 65586 which is OR`ed from a combination of available attributes as pointed out by ourgreat community

so in summary if you program insists that it has written a file to a specified directory but you know its not there check for admin rights if they are not selected in compiler options then they most likely have been written to C:\Users\zebuddi\AppData\Local\VirtualStore + appendage

Hope this helps if you run into this little riddle in the future

Thanks to the community

Zebuddi
malleo, caput, bang. Ego, comprehendunt in tempore
Post Reply