creating a SID for the Everyone group.

 DWORD SidSize;
PSID TheSID;
LPTSTR p; SidSize = SECURITY_MAX_SID_SIZE;
// Allocate enough memory for the largest possible SID.
if(!(TheSID = LocalAlloc(LMEM_FIXED, SidSize)))
{
fprintf(stderr, "Could not allocate memory.\n");
exit();
}
// Create a SID for the Everyone group on the local computer.
if(!CreateWellKnownSid(WinWorldSid, NULL, TheSID, &SidSize))
{
fprintf(stderr,
"CreateWellKnownSid Error %u",
GetLastError());
}
else
{
// Get the string version of the SID (S-1-1-0).
if(!(ConvertSidToStringSid(TheSID, &p)))
{
fprintf(stderr,
"Error during ConvertSidToStringSid.\n");
exit();
} // Use the string SID as needed.
// ... // When done, free the memory used.
LocalFree(p);
LocalFree(TheSID);
}
 typedef enum {

     WinNullSid                                  = ,
WinWorldSid = ,
WinLocalSid = ,
WinCreatorOwnerSid = ,
WinCreatorGroupSid = ,
WinCreatorOwnerServerSid = ,
WinCreatorGroupServerSid = ,
WinNtAuthoritySid = ,
WinDialupSid = ,
WinNetworkSid = ,
WinBatchSid = ,
WinInteractiveSid = ,
WinServiceSid = ,
WinAnonymousSid = ,
WinProxySid = ,
WinEnterpriseControllersSid = ,
WinSelfSid = ,
WinAuthenticatedUserSid = ,
WinRestrictedCodeSid = ,
WinTerminalServerSid = ,
WinRemoteLogonIdSid = ,
WinLogonIdsSid = ,
WinLocalSystemSid = ,
WinLocalServiceSid = ,
WinNetworkServiceSid = ,
WinBuiltinDomainSid = ,
WinBuiltinAdministratorsSid = ,
WinBuiltinUsersSid = ,
WinBuiltinGuestsSid = ,
WinBuiltinPowerUsersSid = ,
WinBuiltinAccountOperatorsSid = ,
WinBuiltinSystemOperatorsSid = ,
WinBuiltinPrintOperatorsSid = ,
WinBuiltinBackupOperatorsSid = ,
WinBuiltinReplicatorSid = ,
WinBuiltinPreWindows2000CompatibleAccessSid = ,
WinBuiltinRemoteDesktopUsersSid = ,
WinBuiltinNetworkConfigurationOperatorsSid = ,
WinAccountAdministratorSid = ,
WinAccountGuestSid = ,
WinAccountKrbtgtSid = ,
WinAccountDomainAdminsSid = ,
WinAccountDomainUsersSid = ,
WinAccountDomainGuestsSid = ,
WinAccountComputersSid = ,
WinAccountControllersSid = ,
WinAccountCertAdminsSid = ,
WinAccountSchemaAdminsSid = ,
WinAccountEnterpriseAdminsSid = ,
WinAccountPolicyAdminsSid = ,
WinAccountRasAndIasServersSid = ,
WinNTLMAuthenticationSid = ,
WinDigestAuthenticationSid = ,
WinSChannelAuthenticationSid = ,
WinThisOrganizationSid = ,
WinOtherOrganizationSid = ,
WinBuiltinIncomingForestTrustBuildersSid = ,
WinBuiltinPerfMonitoringUsersSid = ,
WinBuiltinPerfLoggingUsersSid = ,
WinBuiltinAuthorizationAccessSid = ,
WinBuiltinTerminalServerLicenseServersSid = ,
WinBuiltinDCOMUsersSid = ,
WinBuiltinIUsersSid = ,
WinIUserSid = ,
WinBuiltinCryptoOperatorsSid = ,
WinUntrustedLabelSid = ,
WinLowLabelSid = ,
WinMediumLabelSid = ,
WinHighLabelSid = ,
WinSystemLabelSid = ,
WinWriteRestrictedCodeSid = ,
WinCreatorOwnerRightsSid = ,
WinCacheablePrincipalsGroupSid = ,
WinNonCacheablePrincipalsGroupSid = ,
WinEnterpriseReadonlyControllersSid = ,
WinAccountReadonlyControllersSid = ,
WinBuiltinEventLogReadersGroup = ,
WinNewEnterpriseReadonlyControllersSid = ,
WinBuiltinCertSvcDComAccessGroup = ,
WinMediumPlusLabelSid = ,
WinLocalLogonSid = ,
WinConsoleLogonSid = ,
WinThisOrganizationCertificateSid = ,
} WELL_KNOWN_SID_TYPE;

匹配一个SID与已知的SID是否匹配

 BOOL IsWellKnownSid(
PSID pSid,
WELL_KNOWN_SID_TYPE WellKnownSidType
);

SID(安全标识符)的更多相关文章

  1. Windows Server 2008更改SID

    参考:Windows Server 2012 克隆修改SID 前言 克隆(软克隆,硬克隆)虚拟机后,虚拟机不光名称一样,IP一样(设置静态IP情况下),连SID也一样 什么是SID SID 安全标识符 ...

  2. 从0开始搭建SQL Server AlwaysOn 第一篇(配置域控)

    从0开始搭建SQL Server AlwaysOn 第一篇(配置域控) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www.cnb ...

  3. (转载) 从0开始搭建SQL Server AlwaysOn 第一篇(配置域控)

    安装完之后别忘了还需要安装SSMS,这是坑爹的地方之二,干嘛不集成到SQL Server安装包里还要用户自己单独下载 下载地址:https://msdn.microsoft.com/en-us/lib ...

  4. 安全标识符SID技术介绍及查看技巧

    说到安全标识符SID就要先说说安全主体(Security Principals),安全主体是一个能够对它分配权限的对象,例如,用户.组和计算机: 对于每一个Windows 200x域中的安全主体都有一 ...

  5. [转]在 Windows 操作系统中的已知安全标识符(Sid security identifiers)

    安全标识符 (SID) 是用于标识安全主体或安全组在 Windows 操作系统中的可变长度的唯一值.常用 Sid 的 Sid 标识普通用户的一组或通用组.跨所有操作系统,它们的值保持不变. 此信息可用 ...

  6. VBS脚本获取安全标识符SID(Security Identifiers)的方法

    一.SID简介       SID也就是安全标识符(Security Identifiers),是标识用户.组和计算机帐户的唯一的号码.在第一次创建该帐户时,将给网络上的每一个帐户发布一个唯一的 SI ...

  7. 【windows 访问控制】六、安全标识符(SID Security Identifiers)

    安全标识符(SID Security Identifiers) SID是用来标识安全主体.就是给安全主体一个唯一的ID.用户层面通过用户账户名识别,程序和资源之间通过SID识别. 什么是安全标识符? ...

  8. 解决服务器SID引起虚拟机不能加入AD域用户,无法远程登录的问题

    最近在公司搭建AD域控制器,发现无法在计算机真正添加域用户,也就是添加的用户虽然可以在本地登录,但是无法远程登录,尝试多种方法都无法解决,而最终原因居然是虚拟机导致的服务器的SID冲突.本文记录下该问 ...

  9. 【转】windows server 2012清除并重建SID

    windows server 2012清除并重建SID 2012-09-17 17:51:51 标签:SID windows server 2012 原创作品,允许转载,转载时请务必以超链接形式标明文 ...

随机推荐

  1. SQL优化避免索引失效

    Oracle 索引的目标是避免全表扫描,提高查询效率,但有些时候却适得其反.例如一张表中有上百万条数据,对某个字段加了索引,但是查询时性能并没有什么提高,这可 能是 oracle 索引失效造成的.or ...

  2. Vue学习计划基础笔记(三)-class与style绑定,条件渲染和列表渲染

    Class与style绑定.条件渲染和列表渲染 目标: 熟练使用class与style绑定的多种方式 熟悉v-if与v-for的用法,以及v-if和v-for一起使用的注意事项 class与style ...

  3. 小白初识 - 基数排序(RadixSort)

    基数排序算是桶排序和计数排序的衍生吧,因为基数排序里面会用到这两种其中一种. 基数排序针对的待排序元素是要有高低位之分的,比如单词adobe,activiti,activiti就高于adobe,这个是 ...

  4. Javascript深入__proto__和prototype的区别和联系

    有一个一个装逼的同事,写了一段代码 function a(){} a.__proto__.__proto__.__proto__ 然后问我,下面这个玩意a.__proto__.__proto__.__ ...

  5. nginx 日志模块

    ngx_http_log_module.c 数据结构 typedef struct { void **main_conf; void **srv_conf; void **loc_conf;} ngx ...

  6. win7重装系统后设置Python2.7环境

    起因 台式机的主板莫名出现问题,显示器画面卡顿不能动,鼠标键盘无反应,在这种情况下只好按住电源键断电.下面重启后,显示器无画面,猜测开机后没有进BIOS.然后就拆机箱,拔下电源线后撬起主板电池几秒再放 ...

  7. python---json.dumps 与 json.loads /json.dump 和json.load区别

    json.dumps 是将python的数据类型进行json的编码,生成json格式的数据,举例json_data = json.dumps(str)  str为python的字符串类型数据,生成的j ...

  8. 20135208 JAVA第四次实验

    课程:Java程序与设计     班级:1352 姓名:贺邦 小组成员: 20135212池彬宁 20135208贺邦 学号:20135208 成绩:             指导教师:娄嘉鹏     ...

  9. 2018软工实践—Alpha冲刺(2)

    队名 火箭少男100 组长博客 林燊大哥 作业博客 Alpha 冲鸭鸭! 成员冲刺阶段情况 林燊(组长) 过去两天完成了哪些任务 协调各成员之间的工作 协助前端界面的开发 搭建测试用服务器的环境 完成 ...

  10. 元素相加交换另解&puts的一个用法

    #include<iostream> using namespace std; int main(){ int a,b; cin>>a>>b; a^=b; b^=a ...