【求助】VC编译问题!
GetProcessHandle.cpp(49) : error C2065: 'OpenThread' : undeclared identifierC:/GetProcessHandle.cpp(49) : error C2440: '=' : cannot convert from 'int' to 'void *'
为什么会编译错误?
请帮帮我,我是VC新手。
符代码
#include <Windows.h>
#include <stdio.h>
// Function coded by ViscountPherget
HANDLE GetProcessHandle(bool thread,DWORD desired_access,BOOL inherit_handle,DWORD identifier)
{
HANDLE handle_token;
HANDLE handle;
if(OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&handle_token)==0)
{
return 0;
}
TOKEN_PRIVILEGES privileges_token;
LUID identifier_locally_unique;
TOKEN_PRIVILEGES privileges_token_previous;
DWORD privileges_token_previous_size;
if(LookupPrivilegeValue(0,SE_DEBUG_NAME,&identifier_locally_unique)==0)
{
return 0;
}
privileges_token.PrivilegeCount = 1;
privileges_token.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
privileges_token.Privileges[0].Luid = identifier_locally_unique;
AdjustTokenPrivileges
(
handle_token,
0,
&privileges_token,
sizeof(privileges_token),
&privileges_token_previous,
&privileges_token_previous_size
);
if(GetLastError()!=ERROR_SUCCESS)
{
return 0;
}
privileges_token.Privileges[0].Attributes = privileges_token_previous.Privileges[0].Attributes;
if(thread)
{
handle = OpenThread(desired_access,inherit_handle,identifier); (OpenThread错误?)
}
else
{
handle = OpenProcess(desired_access,inherit_handle,identifier);
}
AdjustTokenPrivileges
(
handle_token,
0,
&privileges_token,
sizeof(privileges_token),
0,
0
);
if(GetLastError()!=ERROR_SUCCESS)
{
return 0;
}
return handle;
}