Page 1 of 1

DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 12:43 am
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

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 1:14 am
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?

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 1:23 am
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.

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 5:35 pm
by Thorium
Sounds like a error in the file system. Try run Scandisk or another tool that searches disk errors.

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 6:33 pm
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 ?

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 8:16 pm
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

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 8:21 pm
by luis
@Zebuddi123

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

@breeze4me

Ah, interesting never saw that value, thanks !

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 8:37 pm
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

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 8:56 pm
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

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sat Feb 18, 2012 9:02 pm
by luis
That's it.

Thanks to breeze4me for pointing out the existence of the flag :)

Re: DirectoryEntryAttribute(0) returns 65568

Posted: Sun Feb 19, 2012 7:07 pm
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