Discussion:
What is "primary domain" in a local network without Active Directory?
(too old to reply)
JJ
2019-10-05 14:03:00 UTC
Permalink
When reading the remarks of the `CreateMailSlot()` function description, I
was curious about the use of a "*" wildcard in the server name part of the
path. i.e.:

[Format]
\\*\mailslot\name

[Usage]
Retrieves a client handle to all mailslots with the specified name in the
system's primary domain.

But I'm confused about that "primary domain" term. I know it's related to
Active Directory, but I don't have any Windows Server system in my local
network, so AFAIK, there's no Active Directory. Thus, what does "primary
domain" refers to, in a local network without Active directory? Does it mean
all computers in the same workgroup as the application which uses that path?
Or is it all computers in the local network including those which are in
different workgroups?
Christian Astor
2019-10-06 08:46:22 UTC
Permalink
Post by JJ
But I'm confused about that "primary domain" term. I know it's related to
Active Directory, but I don't have any Windows Server system in my local
network, so AFAIK, there's no Active Directory. Thus, what does "primary
domain" refers to, in a local network without Active directory? Does it mean
all computers in the same workgroup as the application which uses that path?
Or is it all computers in the local network including those which are in
different workgroups?
You can get it with LSA
On my PC, no network, I get "WORKGROUP" :

NTSTATUS Status;
LSA_HANDLE PolicyHandle;
PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo;
LSA_OBJECT_ATTRIBUTES ObjAttributes;
BOOL IsDomainName = FALSE;
InitializeObjectAttributes(&ObjAttributes, NULL, 0, NULL, NULL);
Status = LsaOpenPolicy(NULL, &ObjAttributes,
POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle);
if (NT_SUCCESS(Status))
{
Status = LsaQueryInformationPolicy(PolicyHandle,
PolicyPrimaryDomainInformation, (PVOID *)&DomainInfo);
LsaClose(PolicyHandle);
}
JJ
2019-10-06 15:23:38 UTC
Permalink
Post by Christian Astor
You can get it with LSA
NTSTATUS Status;
LSA_HANDLE PolicyHandle;
PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo;
LSA_OBJECT_ATTRIBUTES ObjAttributes;
BOOL IsDomainName = FALSE;
InitializeObjectAttributes(&ObjAttributes, NULL, 0, NULL, NULL);
Status = LsaOpenPolicy(NULL, &ObjAttributes,
POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle);
if (NT_SUCCESS(Status))
{
Status = LsaQueryInformationPolicy(PolicyHandle,
PolicyPrimaryDomainInformation, (PVOID *)&DomainInfo);
LsaClose(PolicyHandle);
}
Ah, I see.

When reading the description of the LSA Policy object, I also noticed this.

"On a system that does not have a primary domain, ... . The PrimaryDomain
field contains the name of the workgroup this machine is a member of."

So, thank you.

Loading...