gpt4 book ai didi

c++ - 在 Visual C++ DLL 项目中包含 ntdsapi.h 和 activeds.h 时出错

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:41:01 25 4
gpt4 key购买 nike

我在 Visual Studio 2017 中创建了一个 C++ Windows DLL 项目。以下是我编写的代码,到目前为止除了导入头文件外什么都没有。

#include "stdafx.h"
#include "windows.h"
#include "ntdsapi.h"
#include "activeds.h"

#pragma comment(lib, "ntdsapi.lib")
#pragma comment(lib, "activeds.lib")

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

当我尝试编译时,我在 ntdsapi.h 和 activeds.h header 中遇到了很多错误。但是当我在 Windows C++ 控制台项目中使用相同的 header 时,这似乎工作正常。

我需要使用 ntdsapi.h 和 activeds.h header 中定义的 Active Directory 函数。

错误列表如下:

1>dllmain.cpp
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(924): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(934): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(960): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(971): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(996): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1008): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1036): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1050): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1148): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1159): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1172): error C2065: 'RPC_AUTH_IDENTITY_HANDLE': undeclared identifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1173): error C2146: syntax error: missing ')' before identifier 'AuthIdentity'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1531): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1531): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1542): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1542): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1724): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1724): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1740): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1740): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1794): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1794): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1806): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(1806): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2611): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2611): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2621): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2621): error C2143: syntax error: missing ',' before '*'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2707): error C3646: 'uuidNamingContextObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2707): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2708): error C3646: 'uuidSourceDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2708): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2709): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2709): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2710): error C3646: 'uuidAsyncIntersiteTransportObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2710): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2731): error C3646: 'uuidNamingContextObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2731): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2732): error C3646: 'uuidSourceDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2732): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2733): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2733): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2734): error C3646: 'uuidAsyncIntersiteTransportObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2734): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2757): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2757): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2762): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2762): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2768): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2768): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2776): error C3646: 'uuidSourceDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2776): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2818): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2818): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2827): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2827): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2838): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2838): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2866): error C3646: 'uuidDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2866): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2875): error C3646: 'uuidDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2875): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2912): error C3646: 'uuidNamingContextObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2912): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2913): error C3646: 'uuidDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2913): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2930): error C3646: 'uuidNamingContextObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2930): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2931): error C3646: 'uuidDsaObjGuid': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2931): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2957): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2957): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2975): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2975): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2994): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(2994): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3013): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3013): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3029): error C3646: 'uuidLastOriginatingDsaInvocationID': unknown override specifier
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3029): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3091): error C2061: syntax error: identifier 'UUID'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3103): error C2061: syntax error: identifier 'UUID'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3143): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\ntdsapi.h(3157): error C2061: syntax error: identifier 'RPC_AUTH_IDENTITY_HANDLE'
1>Done building project "AdDll.vcxproj" -- FAILED.

最佳答案

默认情况下,Dll 项目将此定义添加到 stdafx.h。

#define WIN32_LEAN_AND_MEAN        // Exclude rarely-used stuff from Windows 

删除此行并重建。有关精益和平均的更多信息。 https://blogs.msdn.microsoft.com/oldnewthing/20091130-00/?p=15863

关于c++ - 在 Visual C++ DLL 项目中包含 ntdsapi.h 和 activeds.h 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50344449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com