According to Win32.hlp, the API provides the BOOL GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation) function BOOL GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation) in KERNEL32. LPBY_HANDLE_FILE_INFORMATION is BY_HANDLE_FILE_INFORMATION* , where BY_HANDLE_FILE_INFORMATION as follows:
typedef struct _BY_HANDLE_FILE_INFORMATION {
After calling the specified function, if it returns true, BY_HANDLE_FILE_INFORMATION contains data related to your file. dwFileAttributes may contain the FILE_ATTRIBUTE_READ_ONLY flag.
If you want more of this, there are also:
BOOL GetKernelObjectSecurity( HANDLE Handle, // handle of object to query SECURITY_INFORMATION RequestedInformation, // requested information PSECURITY_DESCRIPTOR pSecurityDescriptor, // address of security descriptor DWORD nLength, // size of buffer for security descriptor LPDWORD lpnLengthNeeded // address of required size of buffer );
The API link is necessarily vague as to what SECURITY_DESCRIPTOR , but you can call a bunch of other functions using your address as a parameter to get specific properties. SECURITY_INFORMATION is simply a DWORD constant that determines which of these functions you plan to call. You can find more information at http://msdn.microsoft.com/en-us/library/aa446641%28VS.85%29.aspx
Edit - the second section of the code continues to fail, but the link to the API link takes you where you need to go if you dig a little.
sqykly
source share