new topic     » goto parent     » topic index » view thread      » older message » newer message

by TDIMSO03.backend.tdata.com.ar
 (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002))
 with ESMTPA id <0HJM006CCK9W46 at TDIMSO03.backend.tdata.com.ar> for
 EUforum at topica.com; Thu, 14 Aug 2003 16:46:50 -0300 (GMT)
 Gecko/20030624
From: Guillermo Bonvehi <knixeur at speedy.com.ar>
Subject: Re: Win32 File Attribute Modification
ZyYy3gEHAQAAAAAABwAAAAAAZVQTag at boing.topica.com>

Hi Ted,
	I think this function should work (it's untested, if it doesn't work=20
let me know):

--Start of untested code--
include dll.e

constant krn32 =3D open_dll("kernel32.dll")
constant xSetFileAttributes =3D=20
define_c_func(krn32,"SetFileAttributes",{C_POINTER,C_POINTER},C_INT)

constant FILE_ATTRIBUTE_ARCHIVE =3D 32,
	FILE_ATTRIBUTE_COMPRESSED =3D 2048,
	FILE_ATTRIBUTE_NORMAL =3D 128,
	FILE_ATTRIBUTE_DIRECTORY =3D 16,
	FILE_ATTRIBUTE_HIDDEN =3D 2,
	FILE_ATTRIBUTE_READONLY =3D 1,
	FILE_ATTRIBUTE_SYSTEM =3D 4,
	FILE_ATTRIBUTE_TEMPORARY =3D 256,
	FILE_ATTRIBUTE_SPARSE_FILE =3D #200,
	FILE_ATTRIBUTE_REPARSE_POINT =3D #400,
	FILE_ATTRIBUTE_OFFLINE =3D #1000,
	FILE_ATTRIBUTE_NOT_CONTENT_INDEXED =3D #00002000,
	FILE_ATTRIBUTE_ENCRYPTED  =3D #4000

global function SetFileAttributes(sequence name, atom attribs)
	atom ptr
	integer ret
	ptr =3D allocate_string(name)
	ret =3D c_func(xSetFileAttributes,{name,attribs})
	free(ptr)
	return ret
end function
--End of code--

Example should be like:
	x =3D=20
SetFileAttributes("test.txt",or_all({FILE_ATTRIBUTE_HIDDEN,FILE_ATTRIBUTE_R=
EADONLY}))
	or
	x =3D SetFileAttributes("test.txt",FILE_ATTRIBUTE_NORMAL)

Best Regards,
	Guillermo Bonveh=ED

Ted Fines wrote:
>=20
>=20
> Hi all,
>=20
> I need to modify some file attributes, but don't want to do a=20
> 'system("attrib ...")' call.  Something like result =3D=20
> setFileAttr(myfile,attribs) is what I'm looking for.
>=20
> I searched the archive for libraries for dealing with file attributes,=
=20
> but only found info on looking at file attributes, not modifying them.=
=20=20
> Has someone come up with something I just missed?
>=20
> Thanks,
> Ted Fines
>=20
>=20
>=20
> TOPICA - Start your own email discussion group. FREE!
>=20
>=20
>=20

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu