-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAT_ENV.cpp
More file actions
48 lines (41 loc) · 1020 Bytes
/
Copy pathIAT_ENV.cpp
File metadata and controls
48 lines (41 loc) · 1020 Bytes
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
#include "IAT_DLLS.H"
#include "IAT_ENV.H"
extern "C"
{
GetWindowsDirectoryAPtr IAT_GetWindowsDirectoryA = 0;
GetShortPathNameAPTR IAT_GetShortPathA = 0;
DWORD IAT_DynamicLink_Environment(DWORD iat_settings)
{
DWORD ret = 0;
if (iatKernel32 == 0)
{
iatKernel32 = LoadLibraryA("kernel32.dll");
}
if (iatKernel32 == 0)
{
return 0;
}
if ((iat_settings & IAT_ENV_API_GETWINDOWSDIRA) == (IAT_ENV_API_GETWINDOWSDIRA))
{
IAT_GetWindowsDirectoryA = (GetWindowsDirectoryAPtr)GetProcAddress(iatKernel32, "GetWindowsDirectory");
if (IAT_GetWindowsDirectoryA != 0)
{
ret |= IAT_ENV_API_GETWINDOWSDIRA;
}
}
if ((iat_settings & IAT_ENV_API_GETSHORTPATHA) == (IAT_ENV_API_GETSHORTPATHA))
{
IAT_GetShortPathA = (GetShortPathNameAPTR)GetProcAddress(iatKernel32, "GetShortPathA");
if (IAT_GetShortPathA != 0)
{
ret |= IAT_ENV_API_GETSHORTPATHA;
}
}
return ret;
}
DWORD IAT_DynamicLink_Environment_Cleanup()
{
IAT_GetWindowsDirectoryA = 0;
return 1;
}
}