diff options
Diffstat (limited to 'misc.h')
| -rw-r--r-- | misc.h | 101 |
1 files changed, 101 insertions, 0 deletions
| @@ -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 | |||
| 52 | KPROCESSOR_MODE | ||
| 53 | KeGetPreviousMode( | ||
| 54 | VOID | ||
| 55 | ); | ||
| 56 | |||
| 57 | |||
| 58 | int sprintf(char *buffer, const char *format, ...); | ||
| 59 | int _snprintf(char *buffer, size_t count, const char *format, ...); | ||
| 60 | int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format, ...); | ||
| 61 | |||
| 62 | BOOLEAN 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 | |||
| 74 | extern BOOLEAN BootingUp; | ||
| 75 | |||
| 76 | |||
| 77 | INT32 atoi(IN PCHAR buf); | ||
| 78 | PCHAR itoa(int value, char *string, unsigned int radix); | ||
| 79 | |||
| 80 | /* XXX move to netmisc.c */ | ||
| 81 | ULONG ntohl(IN ULONG netlong); | ||
| 82 | USHORT ntohs(IN USHORT netshort); | ||
| 83 | |||
| 84 | ULONG inet_addr(IN PCCHAR cp); | ||
| 85 | VOID inet_ntoa(ULONG ina, PCHAR buf); | ||
| 86 | PCHAR inet_ntoa2(IN ULONG ina); | ||
| 87 | |||
| 88 | BOOLEAN VerifyUnicodeString(IN PUNICODE_STRING InputUnicodeString, OUT PUNICODE_STRING OutputUnicodeString); | ||
| 89 | BOOLEAN VerifyPwstr(IN PWSTR InputString, IN ULONG InputStringLength); | ||
| 90 | |||
| 91 | BOOLEAN ReadStringRegistryValueA(IN PWSTR RegistryPath, IN PWSTR KeyName, OUT PCHAR Buffer, IN USHORT BufferSize); | ||
| 92 | BOOLEAN ReadStringRegistryValueW(IN PWSTR RegistryPath, IN PWSTR KeyName, OUT PWSTR Buffer, IN USHORT BufferSize); | ||
| 93 | BOOLEAN ReadSymlinkValue(IN PWSTR SymlinkPath, OUT PCHAR Buffer, IN USHORT BufferSize); | ||
| 94 | |||
| 95 | VOID InitPostBootup(); | ||
| 96 | PCHAR GetCurrentUserSid(PUSHORT Size); | ||
| 97 | |||
| 98 | PVOID ExchangeReadOnlyMemoryPointer(IN OUT PVOID *Target, IN PVOID Value); | ||
| 99 | |||
| 100 | |||
| 101 | #endif /* __MISC_H__ */ \ No newline at end of file | ||
