I copied this code from someone a while back. Can anyone explain to me this code in plain english. Especially the last line. Thanks...
Code:Private Sub EnableShutDown() Dim lng_hToken As Long Dim mLUID As LUID Dim mPriv As TOKEN_PRIVILEGES Dim mNewPriv As TOKEN_PRIVILEGES 'The GetCurrentProcess function retrieves a pseudo handle for the current process. 'The OpenProcessToken function opens the access token associated with a process Call OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES + TOKEN_QUERY, lng_hToken) 'The LookupPrivilegeValue function retrieves the 'locally unique identifier (LUID) used on a specified 'system to locally represent the specified privilege name Call LookupPrivilegeValue("", SE_SHUTDOWN_NAME, mLUID) mPriv.PrivilegeCount = 1 mPriv.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED mPriv.Privileges(0).pLuid = mLUID 'Enable shutdown privilege for the current application 'The AdjustTokenPrivileges function enables or disables 'privileges in the specified access token. Enabling or 'disabling privileges in an access token requires 'TOKEN_ADJUST_PRIVILEGES access. Call AdjustTokenPrivileges(lng_hToken, False, mPriv, 4 + (12 * mPriv.PrivilegeCount), mNewPriv, 4 + (12 * mNewPriv.PrivilegeCount)) End Sub




Reply With Quote