Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing windows files permissions by code
Message
De
21/11/2006 11:14:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/11/2006 17:28:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01171171
Message ID:
01171462
Vues:
8
>>>>Hello,
>>>>
>>>>Is it possible to change file permissions from VFP by code? I need to process a list of files to "Allow/Deny" access for "everyone".
>>>
>>>
*function SetAttribs
>>>lparameters tcFileName, tlReadOnly, tlHidden, tlSystem
>>>
>>>#define FILE_ATTRIBUTE_READONLY    0x00000001
>>>#define FILE_ATTRIBUTE_HIDDEN      0x00000002
>>>#define FILE_ATTRIBUTE_SYSTEM      0x00000004
>>>
>>>local lnNewAttr
>>>lnNewAttr = iif(tlReadonly,FILE_ATTRIBUTE_READONLY,0)+;
>>>	  iif(tlHidden,FILE_ATTRIBUTE_HIDDEN,0)+;
>>>	  iif(tlSystem,FILE_ATTRIBUTE_SYSTEM,0)
>>>
>>>declare integer SetFileAttributes in Win32API ;
>>>	string @ lpFileName,  integer dwFileAttributes
>>>declare integer GetFileAttributes in Win32API ;
>>>  string @ lpFileName
>>>
>>>return ( SetFileAttributes(@tcFilename, ;
>>>	bitor(bitand(GetFileAttributes(@tcFilename),0xFFFFFFF8),;
>>>        lnNewAttr)) = 1)
>>
>>Peter,
>>This only changes RHS attributes and no security attributes.
>
>True. However, it is more than nothing. What do you additionally suggest?

I thought of SetFileSecurity but I don't have ready out of the box code for that one.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform