X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinsecur.c;h=8d0b223aa67b6a892f359ee4a3859071478814a4;hb=21101c7397e460933635a7bfed813864fc4f88fe;hp=6e4bd7d4c2fe54e3cbf237c32ed3a2e7e101ac3c;hpb=aba7234bc167c8c056a9ea4f939a6dcda10e84f3;p=PuTTY.git diff --git a/windows/winsecur.c b/windows/winsecur.c index 6e4bd7d4..8d0b223a 100644 --- a/windows/winsecur.c +++ b/windows/winsecur.c @@ -27,6 +27,7 @@ int got_advapi(void) advapi = load_system32_dll("advapi32.dll"); successful = advapi && GET_WINDOWS_FUNCTION(advapi, GetSecurityInfo) && + GET_WINDOWS_FUNCTION(advapi, SetSecurityInfo) && GET_WINDOWS_FUNCTION(advapi, OpenProcessToken) && GET_WINDOWS_FUNCTION(advapi, GetTokenInformation) && GET_WINDOWS_FUNCTION(advapi, InitializeSecurityDescriptor) && @@ -36,21 +37,6 @@ int got_advapi(void) return successful; } -int got_crypt(void) -{ - static int attempted = FALSE; - static int successful; - static HMODULE crypt; - - if (!attempted) { - attempted = TRUE; - crypt = load_system32_dll("crypt32.dll"); - successful = crypt && - GET_WINDOWS_FUNCTION(crypt, CryptProtectMemory); - } - return successful; -} - PSID get_user_sid(void) { HANDLE proc = NULL, tok = NULL; @@ -237,7 +223,7 @@ int make_private_security_descriptor(DWORD permissions, return ret; } -int protectprocess(char *error) +int setprocessacl(char *error) { SID_IDENTIFIER_AUTHORITY world_auth = SECURITY_WORLD_SID_AUTHORITY; SID_IDENTIFIER_AUTHORITY nt_auth = SECURITY_NT_AUTHORITY; @@ -280,16 +266,10 @@ int protectprocess(char *error) goto cleanup; } - if (ERROR_SUCCESS != - SetSecurityInfo( - GetCurrentProcess(), - SE_KERNEL_OBJECT, - OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, - usersid, - NULL, - acl, - NULL - )) { + if (ERROR_SUCCESS != p_SetSecurityInfo + (GetCurrentProcess(), SE_KERNEL_OBJECT, + OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, + usersid, NULL, acl, NULL)) { error=dupprintf("Unable to set process ACL: %s", win_strerror(GetLastError())); goto cleanup;