Pergunta

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.

Foi útil?

Solução

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);

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top