Added a test for GetFileSecurityA.

This commit is contained in:
Stefan Leichter 2005-03-28 10:00:59 +00:00 committed by Alexandre Julliard
parent 89feaca290
commit 3548b87f75
1 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,8 @@ typedef BOOL (WINAPI *fnBuildTrusteeWithSidA)( TRUSTEE *trustee, PSID psid );
typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str ); typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str );
typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str );
typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid );
typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION,
PSECURITY_DESCRIPTOR, DWORD, LPDWORD);
static HMODULE hmod; static HMODULE hmod;
@ -38,6 +40,7 @@ fnBuildTrusteeWithSidA pBuildTrusteeWithSidA;
fnBuildTrusteeWithNameA pBuildTrusteeWithNameA; fnBuildTrusteeWithNameA pBuildTrusteeWithNameA;
fnConvertSidToStringSidA pConvertSidToStringSidA; fnConvertSidToStringSidA pConvertSidToStringSidA;
fnConvertStringSidToSidA pConvertStringSidToSidA; fnConvertStringSidToSidA pConvertStringSidToSidA;
fnGetFileSecurityA pGetFileSecurityA;
struct sidRef struct sidRef
{ {
@ -400,6 +403,32 @@ static void test_luid(void)
test_lookupPrivilegeValue(); test_lookupPrivilegeValue();
} }
static void test_FileSecurity(void)
{
char directory[MAX_PATH];
DWORD retval, outSize;
BOOL result;
BYTE buffer[0x40];
pGetFileSecurityA = (fnGetFileSecurityA)
GetProcAddress( hmod, "GetFileSecurityA" );
if( !pGetFileSecurityA )
return;
retval = GetTempPathA(sizeof(directory), directory);
if (!retval) {
trace("GetTempPathA failed\n");
return;
}
strcpy(directory, "\\Should not exist");
SetLastError(NO_ERROR);
result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize);
todo_wine ok(!result, "GetFileSecurityA should fail for not existing directories\n");
todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "ERROR_FILE_NOT_FOUND expected\n");
}
START_TEST(security) START_TEST(security)
{ {
init(); init();
@ -407,4 +436,5 @@ START_TEST(security)
test_sid(); test_sid();
test_trustee(); test_trustee();
test_luid(); test_luid();
test_FileSecurity();
} }