-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetAddress.c
48 lines (40 loc) · 1.29 KB
/
getAddress.c
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 <windows.h>
#include <stdio.h>
int main()
{
HMODULE hKernel32 = LoadLibrary("Kernel32.dll");
if (hKernel32 == NULL)
{
printf("Error: Unable to load Kernel32.dll.\n");
return 1;
}
FARPROC pCreateFileA = GetProcAddress(hKernel32, "CreateFileA");
FARPROC pWriteFile = GetProcAddress(hKernel32, "WriteFile");
FARPROC pCloseHandle = GetProcAddress(hKernel32, "CloseHandle");
FARPROC pWinExec = GetProcAddress(hKernel32, "WinExec");
if (pCreateFileA == NULL)
{
printf("Error: Unable to find CreateFileA function.\n");
return 1;
}
if (pCloseHandle == NULL)
{
printf("Error: Unable to find CloseHandle function.\n");
return 1;
}
if (pWriteFile == NULL)
{
printf("Error: Unable to find WriteFile function.\n");
return 1;
}
if (pWinExec == NULL) {
printf("Error: Unable to find WinExec function.\n");
return 1;
}
printf("Address of CreateFileA function: %p\n", pCreateFileA);
printf("Address of CloseHandle function: %p\n", pCloseHandle);
printf("Address of WriteFile function: %p\n", pWriteFile);
printf("Address of WinExec function: %p\n", pWinExec);
FreeLibrary(hKernel32);
return 0;
}