//+---------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  File:       shgina.h
//
//  Contents:   MIDL definitions for ILogonEnumUsers, ILogonUser, ILogonUserEnumNotifications,
//              ILogonUserNotification 
//
//----------------------------------------------------------------------------


// TODO: Notes from BryanSt's code review of Reiner's check in.
//       1. #define DISPIDs in another file.  ___id.h
//       2. Rename to lower case first letter of all APIs
//       3. Imple IObjectWithSite for security
//       4. Rename ILogonEnumUsers to LogonUsers (LogonUserCollection)
//       5. get_Domain() should return a INTDomain w/ get_name()
//       6. Break EnumFlags into ::put_sort() and ::put_filter()
//       7. Rename "Count" to "length" to be compatible with the new JavaScript OMs.


typedef enum ILUEOrder
{
    ILEU_MOSTRECENT     = 0,
    ILEU_ALPHABETICAL   = 1,
} ILUEORDER;



import "oaidl.idl";
import "ocidl.idl";


[
    uuid(0A055C02-BABE-4480-BB7B-A8EC723CE9C0),     // LIBID_SHGINALib
    helpstring("SHGINA 1.0 Type Library"),
    lcid(0x0000),
    version(1.0)
]
library SHGINALib
{
    importlib("stdole2.tlb");

/* TODO:
    [
        object,
        uuid(60664CAF-AF0D-1001-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILogonUserNotification Interface"),
        oleautomation
    ]
    interface ILogonUserNotification : IDispatch
    {
        // Properties
        [id(1), propget, helpstring("Get the unique ID of the Notification.")]
        HRESULT UniqueID([out, retval] BSTR* pbstr);
        [id(2), propget, helpstring("Get the image associated with the notification.")]
        HRESULT Image([out, retval] BSTR* pbstr);
        [id(3), propget, helpstring("Get the text string associated with the notification.")]
        HRESULT Text([out, retval] BSTR* pbstr);
        [id(4), propget, helpstring("Get the URL string associated with the notification.")]
        HRESULT URL([out, retval] BSTR* pbstr);
    };
    [
        uuid(60664CAF-AF0D-0001-A300-5C7D25FF22A0),
        helpstring("LogonUserNotification Class")
    ]
    coclass LogonUserNotification
    {
        [default] interface ILogonUserNotification;
    };


    [
        object,
        uuid(60664CAF-AF0D-1002-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILogonUserEnumNotification Interface"),
        oleautomation
    ]
    interface ILogonUserEnumNotifications : IDispatch
    {
        // Properties
        [id(1), propget, helpstring("Get the total number of user notifications.")]
        HRESULT Count([out, retval] UINT* pcNotifications);

        // Methods
        [id(DISPID_VALUE), helpstring("Return a LogonUserNotification given the specified index.")]
        HRESULT Item([in] VARIANT varUserID, [out, retval] ILogonUserNotification** ppUserNotification);
    };
    [
        uuid(60664CAF-AF0D-0002-A300-5C7D25FF22A0),
        helpstring("LogonUserEnumNotifications Class") 
    ]
    coclass LogonUserEnumNotifications
    {
        [default] interface ILogonUserEnumNotifications;
    };
*/

    [
        object,
        uuid(60664CAF-AF0D-1003-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILogonUser Interface"),
        oleautomation
    ]
    interface ILogonUser : IDispatch
    {
        // Properties
        [id(1), propget, helpstring("Get the named user setting.")]
        HRESULT setting([in] BSTR bstrName, [out, retval] VARIANT* pvarVal);

        [id(1), propput, helpstring("Set the named user setting.")]
        HRESULT setting([in] BSTR bstrName, [in] VARIANT varVal);
     
        [id(2), propget, helpstring("Test whether the user is logged on.")]
        HRESULT isLoggedOn([out, retval] VARIANT_BOOL* pbLoggedIn);

        [id(3), propget, helpstring("Test whether the user requires a password.")]
        HRESULT passwordRequired([out, retval] VARIANT_BOOL* pbPasswordRequired);

        [id(4), propget, helpstring("Test whether the user has the interactive logon right.")]
        HRESULT interactiveLogonAllowed([out, retval] VARIANT_BOOL* pbInteractiveLogonAllowed);

        [id(5), propget, helpstring("Check whether the user's profile folder is private.")]
        HRESULT isProfilePrivate([out, retval] VARIANT_BOOL* pbPrivate);

        [id(6), propget, helpstring("Check whether the user has created a password reset disk.")]
        HRESULT isPasswordResetAvailable([out, retval] VARIANT_BOOL* pbResetAvailable);

        // Methods
        [helpstring("Log the user onto the system with the given password.")]
        HRESULT logon([in] BSTR pstrPassword, [out, retval] VARIANT_BOOL* pbRet);

        [helpstring("Log the user off the system.")]
        HRESULT logoff([out, retval] VARIANT_BOOL* pbRet);

        [helpstring("Change the users password.")]
        HRESULT changePassword([in] VARIANT varNewPassword, [in] VARIANT varOldPassword, [out, retval] VARIANT_BOOL* pbRet);

        [helpstring("Set ACLs to make the user's profile folder private.")]
        HRESULT makeProfilePrivate([in] VARIANT_BOOL bPrivate);

        [helpstring("Get the email account name and number of unread messages.")]
        HRESULT getMailAccountInfo([in] UINT uiAccountIndex, [out] VARIANT *pvarAccountName, [out] UINT *pcUnreadMessages);

        /* TODO:
        [helpstring("Return an ILogonUserEnumNotifications to enumerate all notifications associated with the user.")]
        HRESULT EnumUserNotifications([out] ILogonUserEnumNotifications** ppEnumNotifications);
        */
    };    
    [
        uuid(60664CAF-AF0D-0003-A300-5C7D25FF22A0),
        helpstring("LogonUser Class") 
    ]
    coclass ShellLogonUser
    {
        [default] interface ILogonUser;
    };


    [
        object,
        uuid(60664CAF-AF0D-1004-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILogonEnumUsers Interface"),
        oleautomation
    ]
    interface ILogonEnumUsers : IDispatch
    {
        // Properties
        [id(1), propget, helpstring("Get the current domain we are enumerating users on.")]
        HRESULT Domain([out, retval] BSTR* pbstr);

        [id(1), propput, helpstring("Set the current domain we are enumerating users on.")]
        HRESULT Domain([in] BSTR bstr);

        [id(2), propget, helpstring("Get the current enumeration flags.")]
        HRESULT EnumFlags([out, retval] ILUEORDER* porder);

        [id(2), propput, helpstring("Set the current enumeration flags.")]
        HRESULT EnumFlags([in] ILUEORDER order);

        [id(3), propget, helpstring("Get the total number of users.")]
        HRESULT length([out, retval] UINT* pcUsers);

        [id(6), propget, helpstring("Get the current user.")]
        HRESULT currentUser([out, retval] ILogonUser** ppLogonUserInfo);

        // Methods
        [id(DISPID_VALUE), helpstring("Return a LogonUser given the specified name/index.")]
        HRESULT item([in] VARIANT varUserId, [out, retval] ILogonUser** ppLogonUserInfo);

        [id(DISPID_NEWENUM), helpstring("Return an IEnumVARIANT ojbect for all of the users.")]
        HRESULT _NewEnum([out, retval] IUnknown** retval);

        [id(4), helpstring("Create a new user.")]
        HRESULT create([in] BSTR bstrLoginName, [out, retval] ILogonUser **ppLogonUser);

        [id(5), helpstring("Delete a user.")]
        HRESULT remove([in] VARIANT varUserId, [in, optional] VARIANT varBackupPath, [out, retval] VARIANT_BOOL *pbSuccess);

    };
    [
        uuid(60664CAF-AF0D-0004-A300-5C7D25FF22A0),
        helpstring("LogonEnumUsers Class")
    ]
    coclass ShellLogonEnumUsers
    {
        [default] interface ILogonEnumUsers;
    };


    typedef enum ILM_GUEST_FLAGS
    {
        ILM_GUEST_ACCOUNT           = 0x00000000,
        ILM_GUEST_INTERACTIVE_LOGON = 0x00000001,
        ILM_GUEST_NETWORK_LOGON     = 0x00000002,
    } ILM_GUEST_FLAGS;

    [
        object,
        uuid(60664CAF-AF0D-1005-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILocalMachine Interface"),
        oleautomation
    ]
    interface ILocalMachine : IDispatch
    {
        // Properties
        [id(1), propget, helpstring("Get the machine name.")]
        HRESULT MachineName([out, retval] VARIANT* pvarVal);
        [id(2), propget, helpstring("Test whether the Guest account is enabled.")]
        HRESULT isGuestEnabled([in] ILM_GUEST_FLAGS flags, [out, retval] VARIANT_BOOL* pbEnabled);
        [id(3), propget, helpstring("Test whether friendly UI is enabled.")]
        HRESULT isFriendlyUIEnabled([out, retval] VARIANT_BOOL* pbEnabled);
        [id(3), propput, helpstring("Enable or disable friendly UI.")]
        HRESULT isFriendlyUIEnabled([in] VARIANT_BOOL bEnabled);
        [id(4), propget, helpstring("Test whether multiple users is enabled.")]
        HRESULT isMultipleUsersEnabled([out, retval] VARIANT_BOOL* pbEnabled);
        [id(4), propput, helpstring("Enable or disable multiple users.")]
        HRESULT isMultipleUsersEnabled([in] VARIANT_BOOL bEnabled);
        [id(5), propget, helpstring("Test whether remote connections are enabled.")]
        HRESULT isRemoteConnectionsEnabled([out, retval] VARIANT_BOOL* pbEnabled);
        [id(5), propput, helpstring("Enable or disable remote connections.")]
        HRESULT isRemoteConnectionsEnabled([in] VARIANT_BOOL bEnabled);
        [id(6), propget, helpstring("Get a well-known user account name.")]
        HRESULT AccountName([in] VARIANT varAccount, [out, retval] VARIANT* pvarVal);
        [id(7), propget, helpstring("Test whether the machine can be undocked.")]
        HRESULT isUndockEnabled([out, retval] VARIANT_BOOL* pbEnabled);
        [id(8), propget, helpstring("Test whether the machine can be shut down.")]
        HRESULT isShutdownAllowed([out, retval] VARIANT_BOOL* pbEnabled);
        [id(9), propget, helpstring("Test whether all network traffic will be treated as through it were local guest account.")]
        HRESULT isGuestAccessMode([out, retval] VARIANT_BOOL* pbForceGuest);
        [id(100), propget, helpstring("Test whether Offline Files is enabled.")]
        HRESULT isOfflineFilesEnabled([out, retval] VARIANT_BOOL *pbEnabled);

        // Methods
        [id(10), helpstring("Turn Off Computer.")]
        HRESULT TurnOffComputer(void);
        [id(20), helpstring("Signal UI host failure.")]
        HRESULT SignalUIHostFailure(void);
        [id(30), helpstring("Allow external credentials.")]
        HRESULT AllowExternalCredentials(void);
        [id(31), helpstring("Request external credentials.")]
        HRESULT RequestExternalCredentials(void);
        [id(32), helpstring("Logon with external credentials.")]
        HRESULT LogonWithExternalCredentials([in] BSTR pstrUsername, [in] BSTR pstrDomain, [in] BSTR pstrPassword, [out, retval] VARIANT_BOOL* pbRet);
        [id(33), helpstring("Initiate interactive logon with credentials.")]
        HRESULT InitiateInteractiveLogon([in] BSTR pstrUsername, [in] BSTR pstrDomain, [in] BSTR pstrPassword, [in] DWORD dwTimeout, [out, retval] VARIANT_BOOL* pbRet);
        [id(40), helpstring("Undock Computer.")]
        HRESULT UndockComputer(void);
        [id(50), helpstring("Enable the Guest account for interactive and/or network logon.")]
        HRESULT EnableGuest(ILM_GUEST_FLAGS flags);
        [id(51), helpstring("Disable the Guest account for interactive and/or network logon.")]
        HRESULT DisableGuest(ILM_GUEST_FLAGS flags);
   };

    [
        uuid(60664CAF-AF0D-0005-A300-5C7D25FF22A0),
        helpstring("LocalMachine Class")
    ]
    coclass ShellLocalMachine
    {
        [default] interface ILocalMachine;
    };

    [
        object,
        uuid(60664CAF-AF0D-1007-A300-5C7D25FF22A0),
        dual,
        hidden,
        helpstring("ILogonStatusHost Interface"),
        oleautomation
    ]
    interface ILogonStatusHost : IDispatch
    {
        // Methods
        [id(10), helpstring("Initialize.")]
        HRESULT Initialize([in] HINSTANCE hInstance, [in] HWND hwndHost);
        [id(11), helpstring("Window procedure helper.")]
        HRESULT WindowProcedureHelper([in] HWND hwnd, [in] UINT uMsg, [in] VARIANT wParam, [in] VARIANT lParam);
        [id(12), helpstring("UnInitialize.")]
        HRESULT UnInitialize(void);
    };
    [
        uuid(60664CAF-AF0D-0007-A300-5C7D25FF22A0),
        helpstring("LogonStatusHost Class")
    ]
    coclass ShellLogonStatusHost
    {
        [default] interface ILogonStatusHost;
    };

  };
  
