📄 process.h
字号:
/* * process.h * * Copyright (C) 2006 Insigme Co., Ltd * * Authors: * - Chenzhan Hu, Lixing Chu, Limin Jin, Liwei Zhou, Zhiqiang Jiao * * This software has been developed while working on the Linux Unified Kernel * project (http://linux.insigma.com.cn) in the Insigma Reaserch Institute, * which is a subdivision of Insigma Co., Ltd (http://www.insigma.com.cn). * * The project is sponsored by Insigma Co., Ltd. * * The authors can be reached at linux@insigma.com.cn. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * Revision History: * Jan 2006 - Created. *//* * process.h: * Reference to Kernel-win32 code */ #ifndef _PROCESS_H#define _PROCESS_H#include <linux/module.h>#include <linux/win32_process.h>#include <linux/binfmts.h>#include "win32.h"#ifdef CONFIG_UNIFIED_KERNEL#define NtCurrentProcess() ((HANDLE)(ULONG_PTR)-1)#define PEB_BASE 0x7FFDF000#define MAX_PATH 256#define PROCESS_PRIO_NORMAL 6#define FREE_UNI(uni) { if (uni.Length) kfree(uni.Buffer); memset(&uni, 0, sizeof(uni)); }#define NORMALIZE(x, addr) if (x) x = (typeof(x))((void *)(x) + (void *)(addr))#define DENORMALIZE(x, addr) if (x) x = (typeof(x))((void *)(x) - (void *)(addr))#define ALIGN_TO_LONG(x) ALIGN((x), sizeof(LONG))#define PPF_NORMALIZED 1#define DENORMALIZE_PARAMS(params) \{ \ if ((params) && ((params)->Flags & PPF_NORMALIZED)) \ { \ DENORMALIZE((params)->CurrentDirectoryName.Buffer, (params)); \ DENORMALIZE((params)->DllPath.Buffer, (params)); \ DENORMALIZE((params)->ImagePathName.Buffer, (params)); \ DENORMALIZE((params)->CommandLine.Buffer, (params)); \ DENORMALIZE((params)->WindowTitle.Buffer, (params)); \ DENORMALIZE((params)->DesktopInfo.Buffer, (params)); \ DENORMALIZE((params)->ShellInfo.Buffer, (params)); \ DENORMALIZE((params)->RuntimeInfo.Buffer, (params)); \ \ (params)->Flags &= ~PPF_NORMALIZED; \ } \}#define NORMALIZE_PARAMS(params) \{ \ if ((params) && !((params)->Flags & PPF_NORMALIZED)) \ { \ NORMALIZE((params)->CurrentDirectoryName.Buffer, (params)); \ NORMALIZE((params)->DllPath.Buffer, (params)); \ NORMALIZE((params)->ImagePathName.Buffer, (params)); \ NORMALIZE((params)->CommandLine.Buffer, (params)); \ NORMALIZE((params)->WindowTitle.Buffer, (params)); \ NORMALIZE((params)->DesktopInfo.Buffer, (params)); \ NORMALIZE((params)->ShellInfo.Buffer, (params)); \ NORMALIZE((params)->RuntimeInfo.Buffer, (params)); \ \ (params)->Flags |= PPF_NORMALIZED; \ } \}typedef VOID (STDCALL *PPEBLOCKROUTINE)(PVOID);typedef struct _PEB_LDR_DATA{ ULONG Length; BOOLEAN Initialized; PVOID SsHandle; LIST_ENTRY InLoadOrderModuleList; LIST_ENTRY InMemoryOrderModuleList; LIST_ENTRY InInitializationOrderModuleList; PVOID EntryInProgress;} PEB_LDR_DATA, *PPEB_LDR_DATA;typedef struct _RTL_USER_PROCESS_PARAMETERS{ ULONG AllocationSize; ULONG Size; ULONG Flags; ULONG DebugFlags; HANDLE hConsole; ULONG ProcessGroup; HANDLE hStdInput; HANDLE hStdOutput; HANDLE hStdError; UNICODE_STRING CurrentDirectoryName; HANDLE CurrentDirectoryHandle; UNICODE_STRING DllPath; UNICODE_STRING ImagePathName; UNICODE_STRING CommandLine; PWSTR Environment; ULONG dwX; ULONG dwY; ULONG dwXSize; ULONG dwYSize; ULONG dwXCountChars; ULONG dwYCountChars; ULONG dwFillAttribute; ULONG dwFlags; ULONG wShowWindow; UNICODE_STRING WindowTitle; UNICODE_STRING DesktopInfo; UNICODE_STRING ShellInfo; UNICODE_STRING RuntimeInfo;} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;typedef struct _PEB_FREE_BLOCK{ struct _PEB_FREE_BLOCK* Next; ULONG Size;} PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;typedef struct _PEB{ UCHAR InheritedAddressSpace; /* 00h */ UCHAR ReadImageFileExecOptions; /* 01h */ UCHAR BeingDebugged; /* 02h */ BOOLEAN SpareBool; /* 03h */ HANDLE Mutant; /* 04h */ PVOID ImageBaseAddress; /* 08h */ PPEB_LDR_DATA Ldr; /* 0Ch */ PRTL_USER_PROCESS_PARAMETERS ProcessParameters; /* 10h */ PVOID SubSystemData; /* 14h */ PVOID ProcessHeap; /* 18h */ PVOID FastPebLock; /* 1Ch */ PPEBLOCKROUTINE FastPebLockRoutine; /* 20h */ PPEBLOCKROUTINE FastPebUnlockRoutine; /* 24h */ ULONG EnvironmentUpdateCount; /* 28h */ PVOID* KernelCallbackTable; /* 2Ch */ PVOID EventLogSection; /* 30h */ PVOID EventLog; /* 34h */ PPEB_FREE_BLOCK FreeList; /* 38h */ ULONG TlsExpansionCounter; /* 3Ch */ PVOID TlsBitmap; /* 40h */ ULONG TlsBitmapBits[0x2]; /* 44h */ PVOID ReadOnlySharedMemoryBase; /* 4Ch */ PVOID ReadOnlySharedMemoryHeap; /* 50h */ PVOID* ReadOnlyStaticServerData; /* 54h */ PVOID AnsiCodePageData; /* 58h */ PVOID OemCodePageData; /* 5Ch */ PVOID UnicodeCaseTableData; /* 60h */ ULONG NumberOfProcessors; /* 64h */ ULONG NtGlobalFlag; /* 68h */ LARGE_INTEGER CriticalSectionTimeout; /* 70h */ ULONG HeapSegmentReserve; /* 78h */ ULONG HeapSegmentCommit; /* 7Ch */ ULONG HeapDeCommitTotalFreeThreshold; /* 80h */ ULONG HeapDeCommitFreeBlockThreshold; /* 84h */ ULONG NumberOfHeaps; /* 88h */ ULONG MaximumNumberOfHeaps; /* 8Ch */ PVOID* ProcessHeaps; /* 90h */ PVOID GdiSharedHandleTable; /* 94h */ PVOID ProcessStarterHelper; /* 98h */ PVOID GdiDCAttributeList; /* 9Ch */ PVOID LoaderLock; /* A0h */ ULONG OSMajorVersion; /* A4h */ ULONG OSMinorVersion; /* A8h */ USHORT OSBuildNumber; /* ACh */ USHORT OSCSDVersion; /* AEh */ ULONG OSPlatformId; /* B0h */ ULONG ImageSubSystem; /* B4h */ ULONG ImageSubSystemMajorVersion; /* B8h */ ULONG ImageSubSystemMinorVersion; /* BCh */ ULONG ImageProcessAffinityMask; /* C0h */ ULONG GdiHandleBuffer[0x22]; /* C4h */ PVOID PostProcessInitRoutine; /* 14Ch */ PVOID *TlsExpansionBitmap; /* 150h */ ULONG TlsExpansionBitmapBits[0x20]; /* 154h */ ULONG SessionId; /* 1D4h */ PVOID AppCompatInfo; /* 1D8h */ UNICODE_STRING CSDVersion; /* 1DCh */} PEB, *PPEB;extern void ProcessClassInit(void);void KProcessInit(struct kprocess *process, char prio, unsigned long affinity, physical_address_t dir_table_base);void EProcessInit(struct eprocess *process);int create_peb(struct eprocess *process);void ExitProcessThreads(struct ethread *thread, NTSTATUS ExitStatus);void ExitCurrentThread(task_t *tsk, NTSTATUS ExitStatus);NTSTATUS STDCALLNtClose(IN HANDLE Handle);NTSTATUS create_ppb(PRTL_USER_PROCESS_PARAMETERS *ppb_res, struct eprocess *process, struct linux_binprm *bprm, char *image_name, char *dll_path, char *current_dir, PWSTR environ, char *window_title, char *desktop_info, char *shell_info, char *rt_info);NTSTATUS STDCALLNtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus);#endif /* CONFIG_UNIFIED_KERNEL */#endif /* _PROCESS_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -