Вопрос

I can't seem to find a way to get a DN of a workstation (computer) with C++ and WinAPIs. Any ideas how to do this?

PS. The workstation is connected to a domain controller.

PS2. I need the DN of a computer and not the logged on user.

Это было полезно?

Решение

If you want the name of the computer on which your code is running, and it is participating in a domain, then you can use GetComputerObjectName:

#include <security.h>
#include <secext.h>

TCHAR szDN[1024];
ULONG ulSize = sizeof(szDN)/sizeof(szDN[0]);
BOOL res = GetComputerObjectName(NameFullyQualifiedDN, szDN, &ulSize);

Другие советы

You probably want the GetComputerNameEx function documented on http://msdn.microsoft.com/en-us/library/windows/desktop/ms724301%28v=vs.85%29.aspx

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top