如何以编程方式确定 Windows 计算机是否是域的成员?

2022-01-04 00:00:00 windows winapi dns c++

我需要一种方法来确定运行我的程序的计算机是否加入了任何域.它属于哪个特定域并不重要,重要的是它是否连接到任何东西.我正在 vc++ 中针对 Win32 API 进行编码.

I need a way to determine whether the computer running my program is joined to any domain. It doesn't matter what specific domain it is part of, just whether it is connected to anything. I'm coding in vc++ against the Win32 API.

推荐答案

直接来自微软:

如何确定 Windows NT/Windows 2000 计算机是否为域成员

此方法使用 Windows API.来自文章摘要:

This approach uses the Windows API. From the article summary:

本文介绍了如何确定一台计算机是运行 Windows NT 4.0 或 Windows 2000是域的成员,是成员属于工作组,或者是独立的使用本地安全的计算机权限 API.

This article describes how to determine if a computer that is running Windows NT 4.0 or Windows 2000 is a member of a domain, is a member of a workgroup, or is a stand-alone computer using the Local Security Authority APIs.

本文还提供了一个小程序的示例代码,该程序输出运行该程序的计算机是域的一部分、工作组的一部分还是独立计算机.

The article also provides sample code for a small program that outputs whether the computer the program is running on is part of a domain, part of a workgroup, or a standalone computer.

相关文章