home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / umx.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  17.5 KB  |  507 lines

  1. /**********************************************************************/
  2. /**                       Microsoft Windows NT                       **/
  3. /**          Copyright(c) Microsoft Corporation 1992 - 1999          **/
  4. /**********************************************************************/
  5.  
  6. /*
  7.     umx.h
  8.     This file contains the common messages, manifests, types, and
  9.     structures used by User Manager Extensions.
  10.  
  11.     NOTE:  You must include windows.h and lmcons.h *before* this file.
  12. */
  13.  
  14.  
  15.  
  16. #ifndef _UMX_H_
  17. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  18. #define _UMX_H_
  19.  
  20.  
  21.  
  22. //
  23. //  This is the maximum length allowed for an extension menu item.
  24. //
  25.  
  26. #define UME_MENU_TEXT_LEN               50
  27.  
  28.  
  29.  
  30. //
  31. //  This is the current version number of the extension interface.
  32. //
  33.  
  34. #define UME_VERSION                     0
  35.  
  36.  
  37. //
  38. //  These are the two listboxes in the User Manager main window.
  39. //
  40.  
  41. #define UMS_LISTBOX_USERS               0
  42. #define UMS_LISTBOX_GROUPS              1
  43.  
  44.  
  45. //
  46. //  These are the messages sent from the extension to the
  47. //  User Manager application.
  48. //
  49. //      UM_GETSELCOUNT
  50. //
  51. //              Purpose - Retrieves the number of selected items in
  52. //                        the specified listbox.
  53. //
  54. //              wParam  - Listbox index.  This 0-based index specifies
  55. //                        the listbox to query.  For the User Manager,
  56. //                        this may be either UMS_LISTBOX_USERS or
  57. //                        UMS_LISTBOX_GROUPS.
  58. //
  59. //              lParam  - Points to a UMS_GETSELCOUNT structure.
  60. //
  61. //              Returns - TRUE if successful, FALSE if unsuccessful.
  62. //
  63. //
  64. //      UM_GETUSERSEL[AW]
  65. //
  66. //              Purpose - Retrieves a particular selection.
  67. //
  68. //              wParam  - Selection index.  This 0-based index specifies
  69. //                        the selected item to query.  This is used here
  70. //                        since the Users listbox is multiple-select.
  71. //
  72. //              lParam  - Points to a UMS_GETSEL[AW] structure.
  73. //
  74. //              Returns - TRUE if successful, FALSE if unsuccessful.
  75. //
  76. //
  77. //      UM_GETGROUPSEL[AW]
  78. //
  79. //              Purpose - Retrieves a particular selection.
  80. //
  81. //              wParam  - Selection index.  This 0-based index specifies
  82. //                        the selected item to query.  This is useful
  83. //                        for muliple-select listboxes.  Since the Groups
  84. //                        listbox is single-select, this value must always
  85. //                        be zero.
  86. //
  87. //              lParam  - Points to a UMS_GETSEL[AW] structure.
  88. //
  89. //              Returns - TRUE if successful, FALSE if unsuccessful.
  90. //
  91. //
  92. //      UM_GETCURFOCUS[AW]
  93. //
  94. //              Purpose - Retrieves the current application focus.
  95. //
  96. //              wParam  - Must be zero.
  97. //
  98. //              lParam  - Points to a UMS_GETCURFOCUS structure.
  99. //
  100. //              Returns - TRUE if successful, FALSE if unsuccessful.
  101. //
  102. //
  103. //      UM_GETOPTIONS[2]
  104. //
  105. //              Purpose - Retrieves the current option settings
  106. //
  107. //              wParam  - Must be zero.
  108. //
  109. //              lParam  - Points to a UMS_GETOPTIONS[2] structure.
  110. //
  111. //              Returns - TRUE if successful, FALSE if unsuccessful.
  112. //
  113.  
  114. #define UM_GETSELCOUNT                  (WM_USER + 1000)
  115. #define UM_GETUSERSELA                  (WM_USER + 1001)
  116. #define UM_GETUSERSELW                  (WM_USER + 1002)
  117. #define UM_GETGROUPSELA                 (WM_USER + 1003)
  118. #define UM_GETGROUPSELW                 (WM_USER + 1004)
  119. #define UM_GETCURFOCUSA                 (WM_USER + 1005)
  120. #define UM_GETCURFOCUSW                 (WM_USER + 1006)
  121. #define UM_GETOPTIONS                   (WM_USER + 1007)
  122. #define UM_GETOPTIONS2                  (WM_USER + 1008)
  123.  
  124. #ifdef UNICODE
  125. #define UM_GETUSERSEL                 UM_GETUSERSELW
  126. #define UM_GETGROUPSEL                UM_GETGROUPSELW
  127. #define UM_GETCURFOCUS                UM_GETCURFOCUSW
  128. #else   // !UNICODE
  129. #define UM_GETUSERSEL                 UM_GETUSERSELA
  130. #define UM_GETGROUPSEL                UM_GETGROUPSELA
  131. #define UM_GETCURFOCUS                UM_GETCURFOCUSA
  132. #endif  // UNICODE
  133.  
  134.  
  135.  
  136. //
  137. //  These structures are used when the extension is
  138. //  communicating with the application.
  139. //
  140.  
  141.  
  142. //
  143. //  The UMS_LOADMENU[AW] structure is passed to the extension's
  144. //  UMELoadMenu[AW] entrypoint when the extension is loaded.
  145. //
  146. //      dwVersion       - On entry to UMELoadMenu[AW], this will
  147. //                        contain the maximum extension version
  148. //                        supported by the User Manager.  If the
  149. //                        extension supports a lower version, it
  150. //                        should set this field appropriately before
  151. //                        returning.  The User Manager will use
  152. //                        the returned value to determine the
  153. //                        capabilities of the extension.
  154. //
  155. //      szMenuName      - The name of the menu item that is to appear
  156. //                        in the app's main menu.  This value will also
  157. //                        appear in the "Help On Extensions" submene and
  158. //                        the "View" menu.
  159. //
  160. //      hMenu           - A valid HMENU for the popup-menu to be inserted
  161. //                        into the app's main menu.  Ownership of this
  162. //                        handle transfers to the User Manager.  The
  163. //                        extension should *not* destroy this handle.
  164. //
  165. //      szHelpFileName  - The name of the help file associated with this
  166. //                        extension.  This file will be used for the
  167. //                        "Help On Extensions" menu.  This will also be
  168. //                        used when the user presses [F1] while the
  169. //                        extension's menu is dropped.
  170. //
  171. //      dwMenuDelta     - The User Manager will apply this delta
  172. //                        to each menu ID present in hMenu.  This is
  173. //                        to prevent conflicts with other extension's
  174. //                        menu IDs.
  175. //
  176.  
  177. typedef struct _UMS_LOADMENUA
  178. {
  179.     DWORD       dwVersion;
  180.     CHAR        szMenuName[UME_MENU_TEXT_LEN + 1];
  181.     HMENU       hMenu;
  182.     CHAR        szHelpFileName[MAX_PATH];
  183.     DWORD       dwMenuDelta;
  184.  
  185. } UMS_LOADMENUA, * PUMS_LOADMENUA;
  186.  
  187. typedef struct _UMS_LOADMENUW
  188. {
  189.     DWORD       dwVersion;
  190.     WCHAR       szMenuName[UME_MENU_TEXT_LEN + 1];
  191.     HMENU       hMenu;
  192.     WCHAR       szHelpFileName[MAX_PATH];
  193.     DWORD       dwMenuDelta;
  194.  
  195. } UMS_LOADMENUW, * PUMS_LOADMENUW;
  196.  
  197. #ifdef UNICODE
  198. #define UMS_LOADMENU                    UMS_LOADMENUW
  199. #define PUMS_LOADMENU                   PUMS_LOADMENUW
  200. #else   // !UNICODE
  201. #define UMS_LOADMENU                    UMS_LOADMENUA
  202. #define PUMS_LOADMENU                   PUMS_LOADMENUA
  203. #endif  // UNICODE
  204.  
  205. #define UM_SELTYPE_USER     0x10
  206. #define UM_SELTYPE_NORMALUSER   0x1 | UM_SELTYPE_USER
  207. #define UM_SELTYPE_REMOTEUSER   0x2 | UM_SELTYPE_USER
  208. #define UM_SELTYPE_GROUP    0x20
  209. #define UM_SELTYPE_LOCALGROUP   0x4 | UM_SELTYPE_GROUP
  210. #define UM_SELTYPE_GLOBALGROUP  0x8 | UM_SELTYPE_GROUP
  211.  
  212.  
  213. //
  214. //  The UMS_GETSEL[AW] structure is filled in by the User Manager
  215. //  when it handles UM_GETUSERSEL[AW] or UM_GETGROUPSEL[AW] messages.
  216. //  This is used to return the current selection to the extension.
  217. //  Note that this structure contains pointers.  The extension should not
  218. //  assume that these pointers will be valid forever, instead the
  219. //  extension should promptly copy these strings and use the copies.
  220. //
  221. //      dwRID         - The RID of the item.  Note that the RID is not
  222. //                      valid when the UMS_GETSEL describes a group.
  223. //
  224. //      pchName       - Will receive the name of the selected account.
  225. //
  226. //      dwSelType     - Will receive the account type mask associated
  227. //                      with the account.
  228. //
  229. //      pchName       - Will receive the fullname of the selected account.
  230. //                      Note that groups do not have fullnames.
  231. //
  232. //      pchComment    - Will receive the comment of the selected account.
  233. //
  234.  
  235. typedef struct _UMS_GETSELA
  236. {
  237.     DWORD       dwRID;
  238.     LPSTR       pchName;
  239.     DWORD       dwSelType;
  240.     LPSTR       pchFullName;
  241.     LPSTR       pchComment;
  242.  
  243. } UMS_GETSELA, * PUMS_GETSELA;
  244.  
  245. typedef struct _UMS_GETSELW
  246. {
  247.     DWORD       dwRID;
  248.     LPWSTR      pchName;
  249.     DWORD       dwSelType;
  250.     LPWSTR      pchFullName;
  251.     LPWSTR      pchComment;
  252.  
  253. } UMS_GETSELW, * PUMS_GETSELW;
  254.  
  255. #ifdef UNICODE
  256. #define UMS_GETSEL                  UMS_GETSELW
  257. #define PUMS_GETSEL                 PUMS_GETSELW
  258. #else   // !UNICODE
  259. #define UMS_GETSEL                  UMS_GETSELA
  260. #define PUMS_GETSEL                 PUMS_GETSELA
  261. #endif  // UNICODE
  262.  
  263.  
  264. //
  265. //  The UMS_GETSELCOUNT structure is filled in by the User Manager
  266. //  when it handles the UM_GETSELCOUNT message.  This is used to
  267. //  return the number of selected items to the extension.  This could
  268. //  be more than 1 for the user listbox.
  269. //
  270. //      dwItems         - The number of selected items in the listbox.
  271. //
  272.  
  273. typedef struct _UMS_GETSELCOUNT
  274. {
  275.     DWORD       dwItems;
  276. } UMS_GETSELCOUNT, * PUMS_GETSELCOUNT;
  277.  
  278.  
  279. //
  280. //  The UMS_GETCURFOCUS structure is filled in by the User Manager
  281. //  when it handles the UM_GETCURFOCUS message.  This is used to
  282. //  return the current focus of the User Manager application.
  283. //
  284. //      szFocus         - The domain name or server name of the current
  285. //                        focus.  Server names can be distinguished
  286. //                        by the leading backslashes, or by dwFocusType.
  287. //
  288. //      dwFocusType     - This is the type of focus, either
  289. //                        UM_FOCUS_TYPE_DOMAIN (and szFocus is a domain name)
  290. //                        UM_FOCUS_TYPE_WINNT  (and szFocus is a server name)
  291. //                        UM_FOCUS_TYPE_LM     (and szFocus is a server name)
  292. //                        UM_FOCUS_TYPE_UNKNOWN
  293. //
  294. //      szFocusPDC      - This is the PDC of the domain of focus, and is valid
  295. //                        only if focus is set to UM_FOCUS_TYPE_DOMAIN.
  296. //
  297. //      psidFocus       - This points to the SID of the domain of focus.  It
  298. //                        may be NULL.  Note that this pointer will not be
  299. //                        valid forever, the extension should copy the SID
  300. //                        immediately if it intends to use it.
  301. //
  302.  
  303. #define UM_FOCUS_TYPE_DOMAIN    1
  304. #define UM_FOCUS_TYPE_WINNT     2
  305. #define UM_FOCUS_TYPE_LM        3
  306. #define UM_FOCUS_TYPE_UNKNOWN   4
  307.  
  308. typedef struct _UMS_GETCURFOCUSA
  309. {
  310.     CHAR        szFocus[MAX_PATH];
  311.     DWORD       dwFocusType;
  312.     CHAR        szFocusPDC[MAX_PATH];
  313.     PVOID       psidFocus;  // actually a SID pointer
  314. } UMS_GETCURFOCUSA, * PUMS_GETCURFOCUSA;
  315.  
  316. typedef struct _UMS_GETCURFOCUSW
  317. {
  318.     WCHAR       szFocus[MAX_PATH];
  319.     DWORD       dwFocusType;
  320.     WCHAR       szFocusPDC[MAX_PATH];
  321.     PVOID       psidFocus;  // actually a SID pointer
  322. } UMS_GETCURFOCUSW, * PUMS_GETCURFOCUSW;
  323.  
  324. #ifdef UNICODE
  325. #define UMS_GETCURFOCUS             UMS_GETCURFOCUSW
  326. #define PUMS_GETCURFOCUS            PUMS_GETCURFOCUSW
  327. #else   // UNICODE
  328. #define UMS_GETCURFOCUS             UMS_GETCURFOCUSA
  329. #define PUMS_GETCURFOCUS            PUMS_GETCURFOCUSA
  330. #endif  // UNICODE
  331.  
  332.  
  333. //
  334. //  The UMS_GETOPTIONS[2] structure is filled in by the User Manager
  335. //  when it handles the UM_GETOPTIONS[2] message.  This is used to
  336. //  return the current option settings of the User Manager application.
  337. //
  338. //      fSaveSettingsOnExit - Should User Manager settings be saved on exit?
  339. //
  340. //      fConfirmation   - Should permanent and/or dangerous actions be
  341. //                        confirmed?
  342. //
  343. //      fSortByFullName - Should the main user listbox be sorted by
  344. //                        fullname rather than by user name?
  345. //
  346. //      fMiniUserManager - (UMS_GETOPTIONS2 only) Is this the User Manager
  347. //                         rather than the User Manager for Domains?
  348. //
  349. //      fLowSpeedConnection - (UMS_GETOPTIONS2 only) Is the User Manager
  350. //                            optimized for use across a slow network link?
  351. //
  352.  
  353. typedef struct _UMS_GETOPTIONS
  354. {
  355.     BOOL        fSaveSettingsOnExit;
  356.     BOOL        fConfirmation;
  357.     BOOL        fSortByFullName;
  358. } UMS_GETOPTIONS, * PUMS_GETOPTIONS;
  359.  
  360. typedef struct _UMS_GETOPTIONS2
  361. {
  362.     BOOL        fSaveSettingsOnExit;
  363.     BOOL        fConfirmation;
  364.     BOOL        fSortByFullName;
  365.     BOOL        fMiniUserManager;
  366.     BOOL        fLowSpeedConnection;
  367. } UMS_GETOPTIONS2, * PUMS_GETOPTIONS2;
  368.  
  369.  
  370.  
  371.  
  372. //
  373. //  These are the names of the extension entrypoints.
  374. //
  375.  
  376. #define SZ_UME_UNLOADMENU               "UMEUnloadMenu"
  377. #define SZ_UME_INITIALIZEMENU           "UMEInitializeMenu"
  378. #define SZ_UME_REFRESH                  "UMERefresh"
  379. #define SZ_UME_MENUACTION               "UMEMenuAction"
  380.  
  381. #define SZ_UME_LOADMENUW                "UMELoadMenuW"
  382. #define SZ_UME_GETEXTENDEDERRORSTRINGW  "UMEGetExtendedErrorStringW"
  383. #define SZ_UME_CREATEW                  "UMECreateW"
  384. #define SZ_UME_DELETEW                  "UMEDeleteW"
  385. #define SZ_UME_RENAMEW                  "UMERenameW"
  386.  
  387. #define SZ_UME_LOADMENUA                "UMELoadMenuA"
  388. #define SZ_UME_GETEXTENDEDERRORSTRINGA  "UMEGetExtendedErrorStringA"
  389. #define SZ_UME_CREATEA                  "UMECreateA"
  390. #define SZ_UME_DELETEA                  "UMEDeleteA"
  391. #define SZ_UME_RENAMEA                  "UMERenameA"
  392.  
  393. #ifdef UNICODE
  394. #define SZ_UME_LOADMENU                 SZ_UME_LOADMENUW
  395. #define SZ_UME_GETEXTENDEDERRORSTRING   SZ_UME_GETEXTENDEDERRORSTRINGW
  396. #define SZ_UME_CREATE                   SZ_UME_CREATEW
  397. #define SZ_UME_DELETE                   SZ_UME_DELETEW
  398. #define SZ_UME_RENAME                   SZ_UME_RENAMEW
  399. #else   // !UNICODE
  400. #define SZ_UME_LOADMENU                 SZ_UME_LOADMENUA
  401. #define SZ_UME_GETEXTENDEDERRORSTRING   SZ_UME_GETEXTENDEDERRORSTRINGA
  402. #define SZ_UME_CREATE                   SZ_UME_CREATEA
  403. #define SZ_UME_DELETE                   SZ_UME_DELETEA
  404. #define SZ_UME_RENAME                   SZ_UME_RENAMEA
  405. #endif  // UNICODE
  406.  
  407.  
  408.  
  409. //
  410. //  Typedefs for the extension entrypoints.
  411. //
  412.  
  413. typedef DWORD (PASCAL * PUMX_LOADMENUW)( HWND          hWnd,
  414.                                          PUMS_LOADMENUW pumsload );
  415. typedef DWORD (PASCAL * PUMX_LOADMENUA)( HWND          hWnd,
  416.                                          PUMS_LOADMENUA pumsload );
  417.  
  418. typedef LPWSTR (PASCAL * PUMX_GETEXTENDEDERRORSTRINGW)( VOID );
  419. typedef LPSTR  (PASCAL * PUMX_GETEXTENDEDERRORSTRINGA)( VOID );
  420.  
  421. typedef VOID (PASCAL * PUMX_UNLOADMENU)( VOID );
  422.  
  423. typedef VOID (PASCAL * PUMX_INITIALIZEMENU)( VOID );
  424.  
  425. typedef VOID (PASCAL * PUMX_REFRESH)( HWND hwndParent );
  426.  
  427. typedef VOID (PASCAL * PUMX_MENUACTION)( HWND  hwndParent,
  428.                                          DWORD dwEventId );
  429.  
  430. typedef VOID (PASCAL * PUMX_CREATEW)( HWND hwndParent,
  431.                                       PUMS_GETSELW pumsSelection );
  432. typedef VOID (PASCAL * PUMX_CREATEA)( HWND hwndParent,
  433.                                       PUMS_GETSELA pumsSelection );
  434.  
  435. typedef VOID (PASCAL * PUMX_DELETEW)( HWND hwndParent,
  436.                                       PUMS_GETSELW pumsSelection );
  437. typedef VOID (PASCAL * PUMX_DELETEA)( HWND hwndParent,
  438.                                       PUMS_GETSELA pumsSelection );
  439.  
  440. typedef VOID (PASCAL * PUMX_RENAMEW)( HWND hwndParent,
  441.                                       PUMS_GETSELW pumsSelection,
  442.                                       LPWSTR       pchNewName    );
  443. typedef VOID (PASCAL * PUMX_RENAMEA)( HWND hwndParent,
  444.                                       PUMS_GETSELA pumsSelection,
  445.                                       LPSTR        pchNewName    );
  446.  
  447.  
  448. #ifdef  UNICODE
  449. #define PUMX_LOADMENU                   PUMX_LOADMENUW
  450. #define PUMX_GETEXTENDEDERRORSTRING     PUMX_GETEXTENDEDERRORSTRINGW
  451. #define PUMX_CREATE                     PUMX_CREATEW
  452. #define PUMX_DELETE                     PUMX_DELETEW
  453. #define PUMX_RENAME                     PUMX_RENAMEW
  454. #else   // !UNICODE
  455. #define PUMX_LOADMENU                   PUMX_LOADMENUA
  456. #define PUMX_GETEXTENDEDERRORSTRING     PUMX_GETEXTENDEDERRORSTRINGA
  457. #define PUMX_CREATE                     PUMX_CREATEA
  458. #define PUMX_DELETE                     PUMX_DELETEA
  459. #define PUMX_RENAME                     PUMX_RENAMEA
  460. #endif  // UNICODE
  461.  
  462.  
  463.  
  464. //
  465. //  Prototypes for the extension entrypoints.
  466. //
  467.  
  468. DWORD PASCAL UMELoadMenuA( HWND           hwndMessage,
  469.                            PUMS_LOADMENUA pumsload );
  470.  
  471. DWORD PASCAL UMELoadMenuW( HWND           hwndMessage,
  472.                            PUMS_LOADMENUW pumsload );
  473.  
  474. LPSTR  PASCAL UMEGetExtendedErrorStringA( VOID );
  475.  
  476. LPWSTR PASCAL UMEGetExtendedErrorStringW( VOID );
  477.  
  478. VOID PASCAL UMEUnloadMenu( VOID );
  479.  
  480. VOID PASCAL UMEInitializeMenu( VOID );
  481.  
  482. VOID PASCAL UMERefresh( HWND hwndParent );
  483.  
  484. VOID PASCAL UMEMenuAction( HWND hwndParent,
  485.                            DWORD dwEventId );
  486.  
  487. VOID PASCAL UMECreateA( HWND hwndParent,
  488.                         PUMS_GETSELA pumsSelection );
  489. VOID PASCAL UMECreateW( HWND hwndParent,
  490.                         PUMS_GETSELW pumsSelection );
  491.  
  492. VOID PASCAL UMEDeleteA( HWND hwndParent,
  493.                         PUMS_GETSELA pumsSelection );
  494. VOID PASCAL UMEDeleteW( HWND hwndParent,
  495.                         PUMS_GETSELW pumsSelection );
  496.  
  497. VOID PASCAL UMERenameA( HWND hwndParent,
  498.                         PUMS_GETSELA pumsSelection,
  499.                         LPSTR pchNewName );
  500. VOID PASCAL UMERenameW( HWND hwndParent,
  501.                         PUMS_GETSELW pumsSelection,
  502.                         LPWSTR pchNewName );
  503.  
  504.  
  505. #pragma option pop /*P_O_Pop*/
  506. #endif  // _UMX_H_
  507.