阅读:2938回复:6
怎样加密文件夹
请帮忙
|
|
沙发#
发布于:2004-04-10 21:01
在有个API函数LockFile();
Platform SDK: Storage LockFile The LockFile function locks the specified file for exclusive access by the calling process using the specified file handle. To specify additional options, use the LockFileEx function. BOOL LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ); Parameters hFile [in] Handle to the file with a region to be locked. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right. For more information, see File Security and Access Rights. dwFileOffsetLow [in] Low-order word of the starting byte offset in the file where the lock should begin. dwFileOffsetHigh [in] High-order word of the starting byte offset in the file where the lock should begin. Windows Me/98/95: dwFileOffsetHigh must be 0, the sign extension of the value of dwFileOffsetLow. Any other value will be rejected. nNumberOfBytesToLockLow [in] Low-order word of the length of the byte range to be locked. nNumberOfBytesToLockHigh [in] High-order word of the length of the byte range to be locked. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError. Remarks Locking a region of a file gives the threads of the locking process exclusive access to the specified region using this file handle. If the file handle is inherited by a process created by the locking process, the child process is not granted access to the locked region. Locking a region of a file does not prevent reading from a mapped file view. You can lock bytes that are beyond the end of the current file. This is useful to coordinate adding records to the end of a file. Locks may not overlap an existing locked region of the file. If LockFile cannot lock a region of a file, it returns zero immediately. It does not block. To issue a file lock request that will block until the lock is acquired, use LockFileEx without LOCKFILE_FAIL_IMMEDIATELY. If a process terminates with a portion of a file locked or closes a file that has outstanding locks, the locks are unlocked by the operating system. However, the time it takes for the operating system to unlock these locks depends upon available system resources. Therefore, it is recommended that your process explicitly unlock all files it has locked when it terminates. If this is not done, access to these files may be denied if the operating system has not yet unlocked them. The UnlockFile function unlocks a file region locked by LockFile. Example Code For an example, see Appending One File to Another File. Requirements Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95. Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server. Header: Declared in Winbase.h; include Windows.h. Library: Use Kernel32.lib. See Also File Management Functions, CreateFile, LockFileEx, UnlockFile Platform SDK Release: February 2003 What did you think of this topic? Order a Platform SDK CD Requirements Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95. Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server. Header: Declared in Winbase.h; include Windows.h. Library: Use Kernel32.lib. See Also File Management Functions, CreateFile, LockFileEx, UnlockFile |
|
|
板凳#
发布于:2004-04-10 21:16
你看明白了吗
|
|
|
地板#
发布于:2004-04-12 08:58
locks the specified file for exclusive access by the calling process using the specified file handle.
你这个是加密文件夹吗????? |
|
|
地下室#
发布于:2004-04-12 22:00
你为什么要骗我,这是个文件加密的
|
|
5楼#
发布于:2004-04-12 22:15
是我老师告诉我的,我也不没用过,我今天仔细看了,不对,真是对不起了
|
|
|
6楼#
发布于:2004-04-14 14:22
加密文件夹的MS有EFS
仔细看里面的资料 很清楚 也很简单 |
|
|