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