SWDEV-403382 - fix errors for vulkan test (#341)
Change-Id: Icfe4c0cf1745c18caeae419e66544b6770f33e70
이 커밋은 다음에 포함됨:
@@ -20,12 +20,24 @@ THE SOFTWARE.
|
||||
#pragma once
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
#include <Windows.h>
|
||||
#include <winnt.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
#include <winapifamily.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <windef.h>
|
||||
#include <aclapi.h>
|
||||
#include <securitybaseapi.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan_win32.h>
|
||||
#include <vector>
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
@@ -39,6 +51,72 @@ THE SOFTWARE.
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
class WindowsSecurityAttributes
|
||||
{
|
||||
protected:
|
||||
SECURITY_ATTRIBUTES m_winSecurityAttributes;
|
||||
PSECURITY_DESCRIPTOR m_winPSecurityDescriptor;
|
||||
|
||||
public:
|
||||
WindowsSecurityAttributes::WindowsSecurityAttributes()
|
||||
{
|
||||
m_winPSecurityDescriptor = (PSECURITY_DESCRIPTOR)calloc(1, SECURITY_DESCRIPTOR_MIN_LENGTH + 2 * sizeof(void **));
|
||||
if (!m_winPSecurityDescriptor) {
|
||||
throw std::runtime_error("Failed to allocate memory for security descriptor");
|
||||
}
|
||||
|
||||
PSID *ppSID = (PSID *)((PBYTE)m_winPSecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
PACL *ppACL = (PACL *)((PBYTE)ppSID + sizeof(PSID *));
|
||||
|
||||
InitializeSecurityDescriptor(m_winPSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
|
||||
|
||||
SID_IDENTIFIER_AUTHORITY sidIdentifierAuthority = SECURITY_WORLD_SID_AUTHORITY;
|
||||
AllocateAndInitializeSid(&sidIdentifierAuthority, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, ppSID);
|
||||
|
||||
EXPLICIT_ACCESS explicitAccess;
|
||||
ZeroMemory(&explicitAccess, sizeof(EXPLICIT_ACCESS));
|
||||
explicitAccess.grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL;
|
||||
explicitAccess.grfAccessMode = SET_ACCESS;
|
||||
explicitAccess.grfInheritance = INHERIT_ONLY;
|
||||
explicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||
explicitAccess.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
|
||||
explicitAccess.Trustee.ptstrName = (LPTSTR) * ppSID;
|
||||
|
||||
SetEntriesInAcl(1, &explicitAccess, NULL, ppACL);
|
||||
|
||||
SetSecurityDescriptorDacl(m_winPSecurityDescriptor, TRUE, *ppACL, FALSE);
|
||||
|
||||
m_winSecurityAttributes.nLength = sizeof(m_winSecurityAttributes);
|
||||
m_winSecurityAttributes.lpSecurityDescriptor = m_winPSecurityDescriptor;
|
||||
m_winSecurityAttributes.bInheritHandle = TRUE;
|
||||
}
|
||||
|
||||
SECURITY_ATTRIBUTES *
|
||||
WindowsSecurityAttributes::operator&()
|
||||
{
|
||||
return &m_winSecurityAttributes;
|
||||
}
|
||||
|
||||
WindowsSecurityAttributes::~WindowsSecurityAttributes()
|
||||
{
|
||||
PSID *ppSID = (PSID *)((PBYTE)m_winPSecurityDescriptor + SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
PACL *ppACL = (PACL *)((PBYTE)ppSID + sizeof(PSID *));
|
||||
|
||||
if (*ppSID) {
|
||||
FreeSid(*ppSID);
|
||||
}
|
||||
if (*ppACL) {
|
||||
LocalFree(*ppACL);
|
||||
}
|
||||
free(m_winPSecurityDescriptor);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif /* _WIN64 */
|
||||
|
||||
|
||||
class VulkanTest {
|
||||
public:
|
||||
VulkanTest(bool enable_validation)
|
||||
|
||||
새 이슈에서 참조
사용자 차단