Windows NT 4.0 source code leak
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.

413 lines
11 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. win31io.h
  5. Abstract:
  6. This header file contains the Win 3.1 Group/REG.DAT data
  7. structure definitions, as well as the 32 bit group definitions.
  8. Why these aren't in the shell32.dll somewhere I don't know
  9. Author:
  10. Steve Wood (stevewo) 22-Feb-1993
  11. Revision History:
  12. --*/
  13. #ifndef _WIN31IO_
  14. #define _WIN31IO_
  15. #include "win31evt.h"
  16. typedef struct GROUP_DEF {
  17. union {
  18. DWORD dwMagic; /* magical bytes 'PMCC' */
  19. DWORD dwCurrentSize; /* During conversion only */
  20. };
  21. WORD wCheckSum; /* adjust this for zero sum of file */
  22. WORD cbGroup; /* length of group segment (does NOT include tags) */
  23. RECT rcNormal; /* rectangle of normal window */
  24. POINT ptMin; /* point of icon */
  25. WORD nCmdShow; /* min, max, or normal state */
  26. WORD pName; /* name of group */
  27. /* these four change interpretation */
  28. WORD cxIcon; /* width of icons */
  29. WORD cyIcon; /* hieght of icons */
  30. WORD wIconFormat; /* planes and BPP in icons */
  31. WORD wReserved; /* This word is no longer used. */
  32. /* Used internally to hold total size of group, including tags */
  33. WORD cItems; /* number of items in group */
  34. WORD rgiItems[1]; /* array of ITEMDEF offsets */
  35. } GROUP_DEF, *PGROUP_DEF;
  36. #define NSLOTS 16 /* initial number of items entries */
  37. typedef struct ITEM_DEF {
  38. POINT pt; /* location of item icon in group */
  39. WORD idIcon; /* id of item icon */
  40. WORD wIconVer; /* icon version */
  41. WORD cbIconRes; /* size of icon resource */
  42. WORD indexIcon; /* index of item icon */
  43. WORD dummy2; /* - not used anymore */
  44. WORD pIconRes; /* offset of icon resource */
  45. WORD dummy3; /* - not used anymore */
  46. WORD pName; /* offset of name string */
  47. WORD pCommand; /* offset of command string */
  48. WORD pIconPath; /* offset of icon path */
  49. } ITEM_DEF, *PITEM_DEF;
  50. /* the pointers in the above structures are short pointers relative to the
  51. * beginning of the segments. This macro converts the short pointer into
  52. * a long pointer including the proper segment/selector value. It assumes
  53. * that its argument is an lvalue somewhere in a group segment, for example,
  54. * PTR(lpgd->pName) returns a pointer to the group name, but k=lpgd->pName;
  55. * PTR(k) is obviously wrong as it will use either SS or DS for its segment,
  56. * depending on the storage class of k.
  57. */
  58. #define PTR( base, offset ) (LPSTR)((PBYTE)base + offset)
  59. /* this macro is used to retrieve the i-th item in the group segment. Note
  60. * that this pointer will NOT be NULL for an unused slot.
  61. */
  62. #define ITEM( lpgd, i ) ((PITEM_DEF)PTR( lpgd, lpgd->rgiItems[i] ))
  63. #define VER31 0x030A
  64. #define VER30 0x0300
  65. #define VER20 0x0201
  66. /*--------------------------------------------------------------------------*/
  67. /* */
  68. /* Tag Stuff */
  69. /* */
  70. /*--------------------------------------------------------------------------*/
  71. typedef struct _TAG_DEF {
  72. WORD wID; // tag identifier
  73. WORD dummy1; // need this for alignment!
  74. int wItem; // (unde the covers 32 bit point!)item the tag belongs to
  75. WORD cb; // size of record, including id and count
  76. WORD dummy2; // need this for alignment!
  77. BYTE rgb[1];
  78. } TAG_DEF, *PTAG_DEF;
  79. #define GROUP_MAGIC 0x43434D50L /* 'PMCC' */
  80. #define PMTAG_MAGIC GROUP_MAGIC
  81. /* range 8000 - 80FF > global
  82. * range 8100 - 81FF > per item
  83. * all others reserved
  84. */
  85. #define ID_MAINTAIN 0x8000
  86. /* bit used to indicate a tag that should be kept even if the writer
  87. * doesn't recognize it.
  88. */
  89. #define ID_MAGIC 0x8000
  90. /* data: the string 'TAGS'
  91. */
  92. #define ID_WRITERVERSION 0x8001
  93. /* data: string in the form [9]9.99[Z].99
  94. */
  95. #define ID_APPLICATIONDIR 0x8101
  96. /* data: ASCIZ string of directory where application may be
  97. * located.
  98. * this is defined as application dir rather than default dir
  99. * since the default dir is explicit in the 3.0 command line and
  100. * must stay there. The true "new information" is the application
  101. * directory. If not present, search the path.
  102. */
  103. #define ID_HOTKEY 0x8102
  104. /* data: WORD hotkey index
  105. */
  106. #define ID_MINIMIZE 0x8103
  107. /* data none
  108. */
  109. #define ID_LASTTAG 0xFFFF
  110. /* the last tag in the file
  111. */
  112. /*
  113. * Maximium number of items allowed in a group
  114. */
  115. #define CITEMSMAX 50
  116. /*
  117. * Maximium number of groups allowed in PROGMAN
  118. */
  119. #define CGROUPSMAX 40
  120. /*--------------------------------------------------------------------------*/
  121. /*--------------------------------------------------------------------------*/
  122. //
  123. // This is the structure of the .grp files in Windows3.1
  124. //
  125. /* .GRP File format structures -
  126. */
  127. typedef struct _GROUP_DEF16 {
  128. DWORD dwMagic; /* magical bytes 'PMCC' */
  129. WORD wCheckSum; /* adjust this for zero sum of file */
  130. WORD cbGroup; /* length of group segment (does NOT include tags) */
  131. WORD nCmdShow; /* min, max, or normal state */
  132. SMALL_RECT rcNormal; /* rectangle of normal window */
  133. POINTS ptMin; /* point of icon */
  134. WORD pName; /* name of group */
  135. /* these four change interpretation */
  136. WORD cxIcon; /* width of icons */
  137. WORD cyIcon; /* hieght of icons */
  138. WORD wIconFormat; /* planes and BPP in icons */
  139. WORD wReserved; /* This word is no longer used. */
  140. /* Used internally to hold total size of group, including tags */
  141. WORD cItems; /* number of items in group */
  142. WORD rgiItems[1]; /* array of ITEMDEF offsets */
  143. } GROUP_DEF16, *PGROUP_DEF16;
  144. /* this macro is used to retrieve the i-th item in the group segment. Note
  145. * that this pointer will NOT be NULL for an unused slot.
  146. */
  147. #define ITEM16( lpgd16, i ) ((PITEM_DEF16)PTR( lpgd16, lpgd16->rgiItems[i] ))
  148. //
  149. // These structures are not needed for the conversion but it is useful to
  150. // understand what is going on.
  151. //
  152. typedef struct _ITEM_DEF16 {
  153. POINTS pt; /* location of item icon in group */
  154. WORD iIcon; /* index of item icon */
  155. WORD cbHeader; /* size of icon header */
  156. WORD cbANDPlane; /* size of and part of icon */
  157. WORD cbXORPlane; /* size of xor part of icon */
  158. WORD pHeader; /* file offset of icon header */
  159. WORD pANDPlane; /* file offset of AND plane */
  160. WORD pXORPlane; /* file offset of XOR plane */
  161. WORD pName; /* file offset of name string */
  162. WORD pCommand; /* file offset of command string */
  163. WORD pIconPath; /* file offset of icon path */
  164. } ITEM_DEF16, *PITEM_DEF16;
  165. typedef struct _CURSORSHAPE_16 {
  166. WORD xHotSpot;
  167. WORD yHotSpot;
  168. WORD cx;
  169. WORD cy;
  170. WORD cbWidth; /* Bytes per row, accounting for word alignment. */
  171. BYTE Planes;
  172. BYTE BitsPixel;
  173. } CURSORSHAPE_16, *PCURSORSHAPE_16;
  174. typedef struct _TAG_DEF16 {
  175. WORD wID; // tag identifier
  176. WORD wItem; // item the tag belongs to
  177. WORD cb; // size of record, including id and count
  178. BYTE rgb[1];
  179. } TAG_DEF16, *PTAG_DEF16;
  180. typedef struct _ICON_HEADER16 {
  181. WORD xHotSpot;
  182. WORD yHotSpot;
  183. WORD cx;
  184. WORD cy;
  185. WORD cbWidth; /* Bytes per row, accounting for word alignment. */
  186. BYTE Planes;
  187. BYTE BitsPixel;
  188. } ICON_HEADER16, *PICON_HEADER16;
  189. #pragma pack(2)
  190. typedef struct _REG_KEY16 { // key nodes
  191. WORD iNext; // next sibling key
  192. WORD iChild; // first child key
  193. WORD iKey; // string defining key
  194. WORD iValue; // string defining value of key-tuple
  195. } REG_KEY16, *PREG_KEY16;
  196. typedef struct _REG_STRING16 {
  197. WORD iNext; // next string in chain
  198. WORD cRef; // reference count
  199. WORD cb; // length of string
  200. WORD irgb; // offset in string segment
  201. } REG_STRING16, *PREG_STRING16;
  202. typedef union _REG_NODE16 { // a node may be...
  203. REG_KEY16 key; // a key
  204. REG_STRING16 str; // a string
  205. } REG_NODE16, *PREG_NODE16;
  206. typedef struct _REG_HEADER16 {
  207. DWORD dwMagic; // magic number
  208. DWORD dwVersion; // version number
  209. DWORD dwHdrSize; // size of header
  210. DWORD dwNodeTable; // offset of node table
  211. DWORD dwNTSize; // size of node table
  212. DWORD dwStringValue; // offset of string values
  213. DWORD dwSVSize; // size of string values
  214. WORD nHash; // number of initial string table entries
  215. WORD iFirstFree; // first free node
  216. } REG_HEADER16, *PREG_HEADER16;
  217. #define MAGIC_NUMBER 0x43434853L // 'SHCC'
  218. #define VERSION_NUMBER 0x30312E33L // '3.10'
  219. #pragma pack()
  220. //
  221. // Routines defined in group32.c
  222. //
  223. ULONG
  224. QueryNumberOfPersonalGroupNames(
  225. HANDLE CurrentUser,
  226. PHANDLE GroupNamesKey,
  227. PHANDLE SettingsKey
  228. );
  229. BOOL
  230. NewPersonalGroupName(
  231. HANDLE GroupNamesKey,
  232. PWSTR GroupName,
  233. ULONG GroupNumber
  234. );
  235. BOOL
  236. DoesExistGroup(
  237. HANDLE GroupsKey,
  238. PWSTR GroupName
  239. );
  240. PGROUP_DEF
  241. LoadGroup(
  242. HANDLE GroupsKey,
  243. PWSTR GroupFileName
  244. );
  245. BOOL
  246. UnloadGroup(
  247. PGROUP_DEF Group
  248. );
  249. BOOL
  250. ExtendGroup(
  251. PGROUP_DEF Group,
  252. BOOL AppendToGroup,
  253. DWORD cb
  254. );
  255. WORD
  256. AddDataToGroup(
  257. PGROUP_DEF Group,
  258. PBYTE Data,
  259. DWORD cb
  260. );
  261. BOOL
  262. AddTagToGroup(
  263. PGROUP_DEF Group,
  264. WORD wID,
  265. WORD wItem,
  266. WORD cb,
  267. PBYTE rgb
  268. );
  269. PGROUP_DEF
  270. CreateGroupFromGroup16(
  271. LPSTR GroupName,
  272. PGROUP_DEF16 Group16
  273. );
  274. BOOL
  275. SaveGroup(
  276. HANDLE GroupsKey,
  277. PWSTR GroupName,
  278. PGROUP_DEF Group
  279. );
  280. BOOL
  281. DeleteGroup(
  282. HANDLE GroupsKey,
  283. PWSTR GroupName
  284. );
  285. #if DBG
  286. BOOL
  287. DumpGroup(
  288. PWSTR GroupFileName,
  289. PGROUP_DEF Group
  290. );
  291. #endif
  292. //
  293. // Routines defined in group16.c
  294. //
  295. PGROUP_DEF16
  296. LoadGroup16(
  297. PWSTR GroupFileName
  298. );
  299. BOOL
  300. UnloadGroup16(
  301. PGROUP_DEF16 Group
  302. );
  303. #if DBG
  304. BOOL
  305. DumpGroup16(
  306. PWSTR GroupFileName,
  307. PGROUP_DEF16 Group
  308. );
  309. #endif
  310. //
  311. // Routines defined in regdat16.c
  312. //
  313. PREG_HEADER16
  314. LoadRegistry16(
  315. PWSTR RegistryFileName
  316. );
  317. BOOL
  318. UnloadRegistry16(
  319. PREG_HEADER16 Registry
  320. );
  321. BOOL
  322. CreateRegistryClassesFromRegistry16(
  323. HANDLE SoftwareRoot,
  324. PREG_HEADER16 Registry
  325. );
  326. #if DBG
  327. BOOL
  328. DumpRegistry16(
  329. PREG_HEADER16 Registry
  330. );
  331. #endif
  332. #endif // _WIN31IO_