<alcapi.h>

时间:2016-06-29 10:10:06

标签: c++ linker-errors

我想创建一个库,所以我可以modify the ACLs of an Object。 我在VS 2015中创建了一个C ++项目(安装了所有C ++组件),为我提供了DLL库的布局。

我在.cpp文件的上面链接中包含了示例代码,并包含了alcapi.h:

#include <windows.h>
#include <stdio.h>
#include <Aclapi.h>

DWORD AddAceToObjectsSecurityDescriptor(
    LPTSTR pszObjName,          // name of object
    SE_OBJECT_TYPE ObjectType,  // type of object
    LPTSTR pszTrustee,          // trustee for new ACE
    TRUSTEE_FORM TrusteeForm,   // format of trustee structure
    DWORD dwAccessRights,       // access mask for new ACE
    ACCESS_MODE AccessMode,     // type of ACE
    DWORD dwInheritance         // inheritance flags for new ACE
)
{
    DWORD dwRes = 0;
    PACL pOldDACL = NULL, pNewDACL = NULL;
    PSECURITY_DESCRIPTOR pSD = NULL;
    EXPLICIT_ACCESS ea;
...

当我尝试构建它时,我会遇到如下错误:

LNK2028 unresolved token (0A00005D) "extern "C" unsigned long __stdcall SetNamedSecurityInfoW(wchar_t *,enum _SE_OBJECT_TYPE,unsigned long,void *,void *,struct _ACL *,struct _ACL *)" (?SetNamedSecurityInfoW@@$$J228YGKPA_WW4_SE_OBJECT_TYPE@@KPAX2PAU_ACL@@3@Z) referenced in function "unsigned long __cdecl AddAceToObjectsSecurityDescriptor(wchar_t *,enum _SE_OBJECT_TYPE,wchar_t *,enum _TRUSTEE_FORM,unsigned long,enum _ACCESS_MODE,unsigned long)" (?AddAceToObjectsSecurityDescriptor@@$$FYAKPA_WW4_SE_OBJECT_TYPE@@0W4_TRUSTEE_FORM@@KW4_ACCESS_MODE@@K@Z)    
LNK2019 unresolved external symbol "extern "C" unsigned long __stdcall SetNamedSecurityInfoW(wchar_t *,enum _SE_OBJECT_TYPE,unsigned long,void *,void *,struct _ACL *,struct _ACL *)" (?SetNamedSecurityInfoW@@$$J228YGKPA_WW4_SE_OBJECT_TYPE@@KPAX2PAU_ACL@@3@Z) referenced in function "unsigned long __cdecl AddAceToObjectsSecurityDescriptor(wchar_t *,enum _SE_OBJECT_TYPE,wchar_t *,enum _TRUSTEE_FORM,unsigned long,enum _ACCESS_MODE,unsigned long)" (?AddAceToObjectsSecurityDescriptor@@$$FYAKPA_WW4_SE_OBJECT_TYPE@@0W4_TRUSTEE_FORM@@KW4_ACCESS_MODE@@K@Z)

链接器找不到aclapi.h中声明的函数的定义。

我需要做些什么来完成这项工作?

提前致谢。

0 个答案:

没有答案