-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAT_JOBS.cpp
More file actions
85 lines (74 loc) · 1.92 KB
/
Copy pathIAT_JOBS.cpp
File metadata and controls
85 lines (74 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "common.h"
#include "osver.h"
#include "Support\\LWAnsiString\\LWAnsiString.h">
#include "IAT_DLLS.H"
#include "IAT_JOBS.H"
extern "C" {
CreateJobAnsi IAT_CreateJobObjectA=0;
CreateJobAnsi IAT_CreateJobObjectW_DONOTUSEYET=0;
AssignToJob IAT_AssignProcessToJobObject=0;
SetJobLimit IAT_SetInformationJobObject=0;
DWORD IAT_DynamicLinkJob_Cleanup()
{
DWORD ret = 0;
if (iatKernel32 != 0)
{
ret =FreeLibrary(iatKernel32);
iatKernel32 = 0;
}
IAT_CreateJobObjectA = nullptr;
IAT_AssignProcessToJobObject = IAT_CreateJobObjectW_DONOTUSEYET = nullptr;
IAT_SetInformationJobObject = nullptr;
return ret;
}
DWORD IAT_DynamicLinkJob(DWORD IAT_settings)
{
DWORD ret = 0;
if (iatKernel32 == 0)
{
iatKernel32 = LoadLibraryA("kernel32.dll");
}
if (iatKernel32 == 0)
{
return 0;
}
if ( (IAT_settings & IAT_JOB_CREATEJOBA) == (IAT_JOB_CREATEJOBA))
{
IAT_CreateJobObjectA = (CreateJobAnsi) GetProcAddress(iatKernel32, "CreateJobObjectA");
if (IAT_CreateJobObjectA != 0)
{
ret |= IAT_JOB_CREATEJOBA;
}
}
if ((IAT_settings & (IAT_JOB_CREATEJOBW)) == (IAT_JOB_CREATEJOBW))
{
IAT_CreateJobObjectA = (CreateJobAnsi)GetProcAddress(iatKernel32, "CreateJobObjectW");
if (IAT_CreateJobObjectA != 0)
{
ret |= IAT_JOB_CREATEJOBW;
}
}
if ((IAT_settings & (IAT_JOB_ASSIGN_PROCESS)) == (IAT_JOB_ASSIGN_PROCESS))
{
IAT_AssignProcessToJobObject = (AssignToJob)GetProcAddress(iatKernel32, "AssignProcessToJobObject");
if (IAT_AssignProcessToJobObject != 0)
{
ret |= IAT_JOB_ASSIGN_PROCESS;
}
}
if ((IAT_settings & (IAT_JOB_SETINFO)) == (IAT_JOB_SETINFO))
{
IAT_SetInformationJobObject = (SetJobLimit)GetProcAddress(iatKernel32, "SetInformationJobObject");
if (IAT_SetInformationJobObject != 0)
{
ret |= IAT_JOB_SETINFO;
}
}
if (ret != IAT_settings)
{
ret = 0;
IAT_DynamicLinkJob_Cleanup();
}
return ret;
}
}