summaryrefslogtreecommitdiff
path: root/misc.h
diff options
context:
space:
mode:
authortumagonx2017-08-08 10:54:53 +0700
committertumagonx2017-08-08 10:54:53 +0700
commit2acec63b2ed75bf4b71ad257db573c4b8f9639e7 (patch)
treea8bea139ddd26116d44ea182b0b8436f2162e6e3 /misc.h
initial commit
Diffstat (limited to 'misc.h')
-rw-r--r--misc.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/misc.h b/misc.h
new file mode 100644
index 0000000..e49e28d
--- /dev/null
+++ b/misc.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (c) 2004 Security Architects Corporation. All rights reserved.
3 *
4 * Module Name:
5 *
6 * misc.h
7 *
8 * Abstract:
9 *
10 * This module definies various types used by miscellaneous routines.
11 *
12 * Author:
13 *
14 * Eugene Tsyrklevich 23-Feb-2004
15 *
16 * Revision History:
17 *
18 * None.
19 */
20
21
22#ifndef __MISC_H__
23#define __MISC_H__
24
25
26#include <NTDDK.h>
27#include "pathproc.h"
28#include "log.h"
29
30
31// win2k ddk does not know about ExFreePoolWithTag?
32/*
33#ifndef ExFreePoolWithTag
34#define ExFreePoolWithTag(p, tag) ExFreePool(p)
35#endif
36*/
37
38#define _POOL_TAG 'nozO'
39
40
41/* convert seconds into units of 100 nanoseconds for KeWaitFor* & KeDelayExecutionThread functions */
42#define SECONDS(s) ((s) * -10000000)
43
44
45#define ProbeAndReadUnicodeString(Source) \
46 (((Source) >= (UNICODE_STRING * const)MM_USER_PROBE_ADDRESS) ? \
47 (*(volatile UNICODE_STRING * const)MM_USER_PROBE_ADDRESS) : (*(volatile UNICODE_STRING *)(Source)))
48
49
50/* extern defines */
51
52KPROCESSOR_MODE
53KeGetPreviousMode(
54 VOID
55 );
56
57
58int sprintf(char *buffer, const char *format, ...);
59int _snprintf(char *buffer, size_t count, const char *format, ...);
60int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format, ...);
61
62BOOLEAN LearningModePostBootup();
63
64
65#define CURRENT_PROCESS_PID ((ULONG) PsGetCurrentProcessId())
66
67
68#define ON 1
69#define OFF 0
70
71
72/* internal defines */
73
74extern BOOLEAN BootingUp;
75
76
77INT32 atoi(IN PCHAR buf);
78PCHAR itoa(int value, char *string, unsigned int radix);
79
80/* XXX move to netmisc.c */
81ULONG ntohl(IN ULONG netlong);
82USHORT ntohs(IN USHORT netshort);
83
84ULONG inet_addr(IN PCCHAR cp);
85VOID inet_ntoa(ULONG ina, PCHAR buf);
86PCHAR inet_ntoa2(IN ULONG ina);
87
88BOOLEAN VerifyUnicodeString(IN PUNICODE_STRING InputUnicodeString, OUT PUNICODE_STRING OutputUnicodeString);
89BOOLEAN VerifyPwstr(IN PWSTR InputString, IN ULONG InputStringLength);
90
91BOOLEAN ReadStringRegistryValueA(IN PWSTR RegistryPath, IN PWSTR KeyName, OUT PCHAR Buffer, IN USHORT BufferSize);
92BOOLEAN ReadStringRegistryValueW(IN PWSTR RegistryPath, IN PWSTR KeyName, OUT PWSTR Buffer, IN USHORT BufferSize);
93BOOLEAN ReadSymlinkValue(IN PWSTR SymlinkPath, OUT PCHAR Buffer, IN USHORT BufferSize);
94
95VOID InitPostBootup();
96PCHAR GetCurrentUserSid(PUSHORT Size);
97
98PVOID ExchangeReadOnlyMemoryPointer(IN OUT PVOID *Target, IN PVOID Value);
99
100
101#endif /* __MISC_H__ */ \ No newline at end of file