Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
5.4 KiB

  1. #define cbExpressionMax 128
  2. #define cbNameMax 64
  3. #define cbOrderMax 4
  4. typedef struct qryrow {
  5. unsigned char Attribute;
  6. char szExpression[cbExpressionMax];
  7. short Flag;
  8. char szName1[cbNameMax];
  9. char szName2[cbNameMax];
  10. unsigned long ObjectId;
  11. char szOrder[cbOrderMax];
  12. } QRYROW;
  13. #define cqryMax 4
  14. static CODECONST(char) szMSysUserList[] = "MSysUserList";
  15. static CODECONST(char) szMSysGroupList[] = "MSysGroupList";
  16. static CODECONST(char) szMSysUserMemberships[] = "MSysUserMemberships";
  17. static CODECONST(char) szMSysGroupMembers[] = "MSysGroupMembers";
  18. static CODECONST(CODECONST(char) *) rgszSysQry[cqryMax] =
  19. {szMSysUserList, szMSysGroupList, szMSysUserMemberships, szMSysGroupMembers};
  20. #define cqryrowMax (sizeof(rgqryrow) / sizeof (QRYROW))
  21. /* MSysQueries rows for the following system queries: */
  22. /*
  23. sql(s,d,"
  24. procedure MSysUserList;
  25. select MSysAccounts.Name
  26. from MSysAccounts
  27. where MSysAccounts.FGroup = 0
  28. order by MSysAccounts.Name
  29. ;")
  30. sql(s,d,"
  31. procedure MSysGroupList;
  32. select MSysAccounts.Name
  33. from MSysAccounts
  34. where MSysAccounts.FGroup <> 0
  35. order by MSysAccounts.Name
  36. ;")
  37. sql(s,d,"
  38. procedure MSysUserMemberships UserName text;
  39. select B.Name
  40. from MSysGroups, MSysAccounts as A, MSysAccounts as B
  41. where A.Name = UserName and A.FGroup = 0 and
  42. A.Sid = MSysGroups.UserSID and B.Sid = MSysGroups.GroupSid
  43. order by B.Name
  44. ;")
  45. sql(s,d,"
  46. procedure MSysGroupMembers GroupName text;
  47. select distinct MSysAccounts_1.Name
  48. from MSysAccounts, MSysGroups, MSysAccounts as MSysAccounts_1,
  49. MSysAccounts inner join MSysGroups on MSysAccounts.SID = MSysGroups.GroupSID,
  50. MSysGroups inner join MSysAccounts_1 on MSysGroups.UserSID = MSysAccounts_1.SID
  51. where (MSysAccounts.Name = [GroupName] and MSysAccounts.FGroup <> 0 and MSysAccounts_1.FGroup = 0)
  52. ;")
  53. */
  54. /* CONSIDER: the following array should be generated directly from */
  55. /* CONSIDER: a cli extension. */
  56. static CODECONST(QRYROW) rgqryrow[] = {
  57. /* MSysUserList query */
  58. {0, "", 2, "", "", 268435457, '\0', '\0', '\0', '\1'},
  59. {255, "", 0, "", "", 268435457, '\0', '\0', '\0', '\1'},
  60. {3, "", 4, "", "", 268435457, '\0', '\0', '\0', '\1'},
  61. {6, "MSysAccounts.Name", 0, "", "", 268435457, '\0', '\0', '\0', '\1'},
  62. {5, "", -1, "MSysAccounts", "", 268435457, '\0','\0','\0','\1'},
  63. {8, "MSysAccounts.FGroup = 0", -1, "", "", 268435457, '\0','\0','\0','\1'},
  64. {11, "MSysAccounts.Name", -1, "", "", 268435457, '\0','\0','\0','\1'},
  65. /* MSysGroupList query */
  66. {0, "", 2, "", "", 268435458, '\0','\0','\0','\1'},
  67. {255, "", 0, "", "", 268435458, '\0','\0','\0','\1'},
  68. {3, "", 4, "", "", 268435458, '\0','\0','\0','\1'},
  69. {6, "MSysAccounts.Name", 0, "", "", 268435458, '\0','\0','\0','\1'},
  70. {5, "", -1, "MSysAccounts", "", 268435458, '\0','\0','\0','\1'},
  71. {8, "MSysAccounts.FGroup <> 0", -1, "", "", 268435458, '\0','\0','\0','\1'},
  72. {11, "MSysAccounts.Name", -1, "", "", 268435458, '\0','\0','\0','\1'},
  73. /* MSysUserMemberships query */
  74. /* {0, "", 2, "", "", 268435459, '\0','\0','\0','\1'},
  75. {255, "", 0, "", "", 268435459, '\0','\0','\0','\1'},
  76. {3, "", 4, "", "", 268435459, '\0','\0','\0','\1'},
  77. {2, "", 10, "UserName", "", 268435459, '\0','\0','\0','\1'},
  78. {6, "B.Name", 0, "", "", 268435459, '\0','\0','\0','\1'},
  79. {5, "", -1, "MSysGroups", "", 268435459, '\0','\0','\0','\1'},
  80. {5, "", -1, "MSysAccounts", "A", 268435459, '\0','\0','\0','\2'},
  81. {5, "", -1, "MSysAccounts", "B", 268435459, '\0','\0','\0','\3'},
  82. {8, "A.Name = UserName and A.FGroup = 0 and A.Sid = MSysGroups.UserSID and B.Sid = MSysGroups.GroupSid", -1, "", "", 268435459, '\0','\0','\0','\1'},
  83. {11, "B.Name", -1, "", "", 268435459, '\0','\0','\0','\1'}
  84. */
  85. {0, "", 2, "", "", 268435459, '\0','\0','\0','\1'},
  86. {255, "", 0, "", "", 268435459, '\0','\0','\0','\1'},
  87. {3, "", 2, "", "", 268435459, '\0','\0','\0','\1'},
  88. {2, "", 10, "UserName", "", 268435459, '\0','\0','\0','\1'},
  89. {6, "MSysAccounts_1.Name", 0, "", "", 268435459, '\0','\0','\0','\1'},
  90. {5, "", -1, "MSysGroups", "", 268435459, '\0','\0','\0','\1'},
  91. {5, "", -1, "MSysAccounts", "", 268435459, '\0','\0','\0','\2'},
  92. {5, "", -1, "MSysAccounts", "MSysAccounts_1", 268435459, '\0','\0','\0','\3'},
  93. {7, "MSysAccounts.SID = MSysGroups.UserSID", 1, "MSysAccounts", "MSysGroups", 268435459, '\0','\0','\0','\1'},
  94. {7, "MSysGroups.GroupSID = MSysAccounts_1.SID", 1, "MSysGroups", "MSysAccounts_1", 268435459, '\0','\0','\0','\2'},
  95. {8, "MSysAccounts.Name = [UserName] and MSysAccounts.FGroup = 0 and MSysAccounts_1.FGroup <> 0", -1, "", "", 268435459, '\0','\0','\0','\1'},
  96. /* MSysGroupMembers query */
  97. {0, "", 2, "", "", 268435460, '\0','\0','\0','\1'},
  98. {255, "", 0, "", "", 268435460, '\0','\0','\0','\1'},
  99. {3, "", 2, "", "", 268435460, '\0','\0','\0','\1'},
  100. {2, "", 10, "GroupName", "", 268435460, '\0','\0','\0','\1'},
  101. {6, "MSysAccounts_1.Name", 0, "", "", 268435460, '\0','\0','\0','\1'},
  102. {5, "", -1, "MSysGroups", "", 268435460, '\0','\0','\0','\1'},
  103. {5, "", -1, "MSysAccounts", "", 268435460, '\0','\0','\0','\2'},
  104. {5, "", -1, "MSysAccounts", "MSysAccounts_1", 268435460, '\0','\0','\0','\3'},
  105. {7, "MSysAccounts.SID = MSysGroups.GroupSID", 1, "MSysAccounts", "MSysGroups", 268435460, '\0', '\0', '\0', '\1'},
  106. {7, "MSysGroups.UserSID = MSysAccounts_1.SID", 1, "MSysGroups", "MSysAccounts_1", 268435460, '\0', '\0', '\0', '\2'},
  107. {8, "MSysAccounts.Name = GroupName and MSysAccounts.FGroup <> 0 and MSysAccounts_1.FGroup = 0", -1, "", "", 268435460, '\0','\0','\0','\1'}
  108. };