如何取得本地计算机的域名?

powerboy 2003-10-16 04:44:50
如何取得本地计算机的域名?
...全文
65 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
galiton 2003-10-17
  • 打赏
  • 举报
回复
up
pbcoder 2003-10-17
  • 打赏
  • 举报
回复
学习。
longdrang 2003-10-17
  • 打赏
  • 举报
回复
看不懂,help you up.
incats 2003-10-16
  • 打赏
  • 举报
回复
msdn:
NTSTATUS LsaQueryInformationPolicy(
LSA_HANDLE PolicyHandle,
POLICY_INFORMATION_CLASS InformationClass,
PVOID* Buffer
);

PPOLICY_PRIMARY_DOMAIN_INFO PrimaryDomain; LPWSTR szPrimaryDomainName = NULL; LPWSTR DomainController = NULL; // // get the primary domain // Status = LsaQueryInformationPolicy( PolicyHandle, PolicyPrimaryDomainInformation, &PrimaryDomain ); if(Status != STATUS_SUCCESS) goto cleanup; // // if the primary domain Sid is NULL, we are a non-member, and // our work is done. // if(PrimaryDomain->Sid == NULL) { LsaFreeMemory(PrimaryDomain); bSuccess = TRUE; goto cleanup; } AddTrustToList(&PrimaryDomain->Name); // // build a copy of what we just added. This is necessary in order // to lookup the domain controller for the specified domain. // the Domain name must be NULL terminated for NetGetDCName(), // and the LSA_UNICODE_STRING buffer is not necessarilly NULL // terminated. Note that in a practical implementation, we // could just extract the element we added, since it ends up // NULL terminated. // szPrimaryDomainName = (LPWSTR)HeapAlloc( GetProcessHeap(), 0, PrimaryDomain->Name.Length + sizeof(WCHAR) // existing length + NULL );

680

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder API 调用
社区管理员
  • API 调用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧