From 3548b87f75ec91a3508a7e9aa449eb44c847d695 Mon Sep 17 00:00:00 2001 From: Stefan Leichter Date: Mon, 28 Mar 2005 10:00:59 +0000 Subject: [PATCH] Added a test for GetFileSecurityA. --- dlls/advapi32/tests/security.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 49f61bccd90..71338f07c89 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -31,6 +31,8 @@ typedef BOOL (WINAPI *fnBuildTrusteeWithSidA)( TRUSTEE *trustee, PSID psid ); typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str ); typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); +typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR, DWORD, LPDWORD); static HMODULE hmod; @@ -38,6 +40,7 @@ fnBuildTrusteeWithSidA pBuildTrusteeWithSidA; fnBuildTrusteeWithNameA pBuildTrusteeWithNameA; fnConvertSidToStringSidA pConvertSidToStringSidA; fnConvertStringSidToSidA pConvertStringSidToSidA; +fnGetFileSecurityA pGetFileSecurityA; struct sidRef { @@ -400,6 +403,32 @@ static void test_luid(void) 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) { init(); @@ -407,4 +436,5 @@ START_TEST(security) test_sid(); test_trustee(); test_luid(); + test_FileSecurity(); }