Howto find out primary domain RID/SID and account domain RID/SID

Hi,

in userspace, there are some functions which help me query the primary
domain rid/sid and account domain rid/sid:

status = LsaOpenPolicy(NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION,
&policyHandle);
if (status == 0)
status = LsaQueryInformationPolicy(policyHandle,
PolicyPrimaryDomainInformation, (PVOID *) &domainInfo);
if (status == 0) {

}

Is there any chance to do something equal in kernel mode?

Oliver