this is not good, is harmful to csdn all fourm, we'd forbidden it decided
You are too strong. You can find so hard question. I admire you.
UUUUUUUUUU------>>>>>>>>PPPPPPPPPPPPPP
很可惜~~~~~~~~~~~~~~~~ ☆WIN2000中关机☆
在模块中添加: Public Type LUID UsedPart As Long IgnoredForNowHigh32BitPart As Long End TypePublic Type TOKEN_PRIVILEGES PrivilegeCount As Long TheLuid As LUID Attributes As Long End TypeDeclare Function GetCurrentProcess Lib "kernel32" () As Long Declare Function OpenProcessToken Lib "advapi32" ( _ ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, _ TokenHandle As Long) As Long Declare Function LookupPrivilegeValue Lib "advapi32" _ Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, _ ByVal lpName As String, lpLuid As LUID) As Long Declare Function AdjustTokenPrivileges Lib "advapi32" ( _ ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, _ NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, _ PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long 再在调用ExitWindowsEx之前调用这个过程 Private Sub AdjustToken() ' 重启win2000和winnt的必要函数Const TOKEN_ADJUST_PRIVILEGES = &H20 Const TOKEN_QUERY = &H8 Const SE_PRIVILEGE_ENABLED = &H2 Dim hdlProcessHandle As Long Dim hdlTokenHandle As Long Dim tmpLuid As LUID Dim tkp As TOKEN_PRIVILEGES Dim tkpNewButIgnored As TOKEN_PRIVILEGES Dim lBufferNeeded As LonghdlProcessHandle = GetCurrentProcess() OpenProcessToken hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or _ TOKEN_QUERY), hdlTokenHandle' Get the LUID for shutdown privilege. LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuidtkp.PrivilegeCount = 1 ' One privilege to set tkp.TheLuid = tmpLuid tkp.Attributes = SE_PRIVILEGE_ENABLED' Enable the shutdown privilege in the access token of this ' process. AdjustTokenPrivileges hdlTokenHandle, False, tkp, _ Len(tkpNewButIgnored), tkpNewButIgnored, lBufferNeededEnd Sub
to jennyvenus(JennyVenus) :我晕啊!! 好几天没有来了,昨天偶然上来看见个问题,回答一下,怎么也被你搬上来示众了?感情觉得我也是在倒分了?? 你要有依据的!!不能胡说!!
UPUPUPUPUP
UPUPUPUPUP
这个高难度的问题都被你发现了,佩服。
支持你!
You can find so hard question.
I admire you.
☆WIN2000中关机☆
在模块中添加:
Public Type LUID
UsedPart As Long
IgnoredForNowHigh32BitPart As Long
End TypePublic Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End TypeDeclare Function GetCurrentProcess Lib "kernel32" () As Long
Declare Function OpenProcessToken Lib "advapi32" ( _
ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, _
TokenHandle As Long) As Long
Declare Function LookupPrivilegeValue Lib "advapi32" _
Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, _
ByVal lpName As String, lpLuid As LUID) As Long
Declare Function AdjustTokenPrivileges Lib "advapi32" ( _
ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, _
NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, _
PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
再在调用ExitWindowsEx之前调用这个过程
Private Sub AdjustToken() ' 重启win2000和winnt的必要函数Const TOKEN_ADJUST_PRIVILEGES = &H20
Const TOKEN_QUERY = &H8
Const SE_PRIVILEGE_ENABLED = &H2
Dim hdlProcessHandle As Long
Dim hdlTokenHandle As Long
Dim tmpLuid As LUID
Dim tkp As TOKEN_PRIVILEGES
Dim tkpNewButIgnored As TOKEN_PRIVILEGES
Dim lBufferNeeded As LonghdlProcessHandle = GetCurrentProcess()
OpenProcessToken hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or _
TOKEN_QUERY), hdlTokenHandle' Get the LUID for shutdown privilege.
LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuidtkp.PrivilegeCount = 1 ' One privilege to set
tkp.TheLuid = tmpLuid
tkp.Attributes = SE_PRIVILEGE_ENABLED' Enable the shutdown privilege in the access token of this
' process.
AdjustTokenPrivileges hdlTokenHandle, False, tkp, _
Len(tkpNewButIgnored), tkpNewButIgnored, lBufferNeededEnd Sub